我在jsp页面中这样
function getUpdate(monitorId){
      window.open("/xdoa/toupdatemonitorservlet?monitorId="+monitorId);
    }
<input type="button" class="border1" value="修改" onclick="getUpdate('${monitor.monitorId}')"/>
接收端的Servlet 这样
String temp = request.getParameter("monitorId");
    int temp2 = Integer.parseInt(temp); 以前这样写的都是很正常的 这次不知道是差在哪了

解决方案 »

  1.   


    这是在JBuilder 中写 , /xdoa 是项目中的一个文件夹名称
      

  2.   

    window.open("<%=request.getContextPath()%>/xdoa/toupdatemonitorservlet?monitorId="+monitorId);
      

  3.   


    这样写 在servlet 中 使用request.getParameter()  就可以了是么?
      

  4.   

    这样:window.open(" <%=request.getContextPath()%>/项目名/xdoa/toupdatemonitorservlet?monitorId="+monitorId); 
      

  5.   

    直接在地址榄中输入地址试试。如果成功再改jsp。
      

  6.   

    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    window.open("<%=basePath%>路径/toupdatemonitorservlet?monitorId="+monitorId);//路径前面不要加"/"
      

  7.   

    找到问题了 我原本那样写实没问题的  原因不在那我servlet 中出现NullPointerException 的地方 下面有一个if()判断 , 当然我当时的操作是不会使程序执行到那个if 块里面的 , (我那个if块里面有错误) , 最后我注释掉了 if 相关的所有代码  就没报错了