.equals 总是出错 "An exception occurred processing JSP page"

每次写jsp,在进行判断的时候用

String Priority=(String)request.getParameter("priority");
  String priority=" ";
  if(Priority.equals("all")){===========================这句话经常报错

   priority = " ";
  }
  else priority = " and s.priority = '"+Priority+"' ";

 

看了这个知道了   http://topic.csdn.net/u/20100318/20/e16af13a-30bd-40e1-9eae-c0aff2307dbb.html

反过来比较就可以了

变量常量的问题

 

第一次打开jsp  这个值是null   但是被拉来做这个判断  自然报错了

 

String Priority=(String)request.getParameter("priority");
  String priority=" ";
  if("all".equals(Priority)){
   priority = " ";
  }
  else priority = " and s.priority = '"+Priority+"' ";

你可能感兴趣的:(.equals 总是出错 "An exception occurred processing JSP page")