数据转换错误java.lang.numberformatexception null java.lang.integer
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/12 00:33:12
数据转换错误java.lang.numberformatexception null java.lang.integer.parseint integer.java
org.apache.jasper.JasperException:An exception occurred processing JSP page /reply.jsp at line 6
3:
4:
8:
9:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NumberFormatException:null
java.lang.Integer.parseInt(Integer.java:415)
java.lang.Integer.parseInt(Integer.java:497)
org.apache.jsp.reply_jsp._jspService(reply_jsp.java:57)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
org.apache.jasper.JasperException:An exception occurred processing JSP page /reply.jsp at line 6
3:
4:
8:
9:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NumberFormatException:null
java.lang.Integer.parseInt(Integer.java:415)
java.lang.Integer.parseInt(Integer.java:497)
org.apache.jsp.reply_jsp._jspService(reply_jsp.java:57)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
错误出现原因:数字格式化异常,如果id、rootId 是null,你的代码是要把null转换成int类型,就会出错,可以修改代码如下:
int id = 0;
int rootId = 0;
if(request.getParameter("id") != null && !"".equals(request.getParameter("id"))) {
id = Integer.parseInt(request.getParameter("id"));
}
if(request.getParameter("rootId") != null && !"".equals(request.getParameter("rootId"))) {
rootId = Integer.parseInt(request.getParameter("rootId"));
}
int id = 0;
int rootId = 0;
if(request.getParameter("id") != null && !"".equals(request.getParameter("id"))) {
id = Integer.parseInt(request.getParameter("id"));
}
if(request.getParameter("rootId") != null && !"".equals(request.getParameter("rootId"))) {
rootId = Integer.parseInt(request.getParameter("rootId"));
}
数据转换错误java.lang.numberformatexception null java.lang.integer
发生错误 java.lang.NumberFormatException:null
java.lang.NumberFormatException:null java.lang.NumberFormatE
有关java.lang.NumberFormatException:null的问题
java.lang.NullPointerException错误
java.lang.integer.MAX_VALUE 啥意思?
java.lang.Exception, java.lang.RuntimeException, java.lang.E
java.lang.ClassCastException: java.lang.Long
java.lang.IllegalStateException:Target host must not be null
java.lang.SecurityException是什么意思
java.lang.illegalstateexception
java.lang.IllegalStateException异常