判断错误
String getSessionat_name=(String)session.getAttribute( "getSessionat_name ");
String getSessionat_id=(String)session.getAttribute( "getSessionat_id ");
int getSessionat_id_s=Integer.parseInt(getSessionat_id);
if((getSessionat_name!=null) && (getSessionat_id!=null)){
if (!Registeruser.checkSessionat(getSessionat_name,getSessionat_id_s)){
out.println( "成功 ");
}
else
{
out.println( "验证错误 ");
}
}
else{
out.println( "无参数 ");}
}
------------------------
当SESSION的值为空时就出现以下错误
我已经判断为空了,为什么还错.请教,如果不为空是正常的.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: null
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:415)
java.lang.Integer.parseInt(Integer.java:497)
org.apache.jsp.vipuser.usermain_jsp._jspService(usermain_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
---------------------------------
------解决方案--------------------int getSessionat_id_s=Integer.parseInt(getSessionat_id);
这句,如果getSessionat_id为null,就出错。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html