日期:2014-05-17  浏览次数:20685 次

jsp页面传递NULL值出错?
http://localhost:8080/command/sta/deplistnum.jsp?page=1&subtime=null&subdep=2&flag=0&total=null&from=null&to=null&isused=null&yes=1


在接受页面中,如下代码

 String from1=(String)request.getParameter("from");
  String to1=(String)request.getParameter("to");


if((from1==null&&to1==null)){

.....
}

按理应该进入括弧的程序,但是并没有,也就是from1,to1不是null

为什么?

------解决方案--------------------
俩个不一样的
http://localhost:8080/command/sta/deplistnum.jsp?page=1&subtime=null&subdep=2&flag=0&total=null&from=null&to=null&isused=null&yes=1
这个里面的null是字符串
String from1=(String)request.getParameter("from");
String to1=(String)request.getParameter("to");
如果得到的值是null 这个里面的null是类型