webapp上传到局域网 其他计算机访问

学艺不精........其他计算机能够正常访问,各种操作也可以完成,但是提示信息出现在作为服务器的那一台计算机上,在服务器这边点确定了,其他计算机才能进行操作

2个回答

给图呀。应该是你使用的是application(或ServletContext)存储的变量,把他换成session试试

qq_22120815
qq_22120815 只是提示JOptionPane.showMessageDialog(null, "保存成功"); 这个session怎么弄......
大约一年之前 回复

是要代码的图么
HttpSession session=request.getSession(true);
request.setCharacterEncoding("utf-8");//防止中文乱码
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
carBean regBean = new carBean();//创建javaBean对象regBean
PreparedStatement sql;
session.setAttribute("regBean", regBean);
String inwhy = request.getParameter("why").trim();//获取网页传过来的值
String inone = request.getParameter("one").trim();
String inwho= request.getParameter("who").trim();
String indestination = request.getParameter("destination").trim();
String inonedate= request.getParameter("one_date").trim();
String inpeople= request.getParameter("people").trim();
String infzr = request.getParameter("fzr").trim();
String infgld= request.getParameter("fgld").trim();
String intwo = request.getParameter("two").trim();
String inopinion = request.getParameter("opinion").trim();
String indriver= request.getParameter("driver").trim();
String intwodate= request.getParameter("two_date").trim();
String inapplydate= request.getParameter("applydate").trim();
//String backNews="";

    try{
        Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+ "1?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false","root","");//数据库连接语句
        String info = "INSERt INTO car(why,one,who,destination,onedate,people,fzr,fgld,opinion,two,driver,twodate,applydate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
        Statement s = connect.createStatement();
        sql=connect.prepareStatement(info);
        sql.setString(1, inwhy);//给上边的?赋值
        sql.setString(2,inone);
        sql.setString(3, inwho);
        sql.setString(4, indestination);
        sql.setString(5,inonedate);
        sql.setString(6, inpeople);
        sql.setString(7, infzr);
        sql.setString(8, infgld);
        sql.setString(9, inopinion);
        sql.setString(10, intwo);
        sql.setString(11, indriver);
        sql.setString(12, intwodate);
        sql.setString(13, inapplydate);
        int m=sql.executeUpdate();//执行sql语句
        //String backNews="";
        if(m!=0){//如果成功执行sql语句
        //backNews="添加成功";
        JOptionPane.showMessageDialog(null, "保存成功"); //提示信息
        //regBean.setBackNews(backNews);//给Bean赋值
        regBean.setDestination(indestination);
        regBean.setDriver(indriver);
        regBean.setWhy(inwhy);
        regBean.setOne(inone);
        regBean.setWho(inwho);
        regBean.setOne_date(inonedate);
        regBean.setPeople(inpeople);
        regBean.setFzr(infzr);
        regBean.setFgld(infgld);
        regBean.setOpinion(inopinion);
        regBean.setTwo(intwo);
        regBean.setTwo_date(intwodate);
        regBean.setApplydate(inapplydate);
        }
        RequestDispatcher dispatcher = request.getRequestDispatcher("printcar.jsp");//转发
        dispatcher.forward(request, response);
        connect.close();//关闭数据库连接
        s.close();
    }catch(SQLException ce){
        System.out.println(ce);
    }
qq_22120815
qq_22120815 回复qq_41906761: 啊 我知道了 我犯了愚蠢的错误 我搞懂了 谢谢哈
大约一年之前 回复
qq_22120815
qq_22120815 回复qq_41906761: 我把代码弄上去了,麻烦您帮我看一下哈 谢谢
大约一年之前 回复
qq_41906761
人到中年就秃头 需要点确定的代码
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问