2012-12-05 47 views
0

我試圖提交一個數字作爲輸入,並且出現此錯誤。我不知道發生了什麼問題!請給您的見解使用日期時的JSP JasperException

org.apache.jasper.JasperException: An exception occurred processing JSP page /SubmitMovie.jsp at line 14 

11: int id=Integer.parseInt(request.getParameter("rowId").trim()); 
12: int membid=0; 
13: String[] values=request.getParameterValues("memb"); 
14: int len=values.length; 
15: for(int i=0;i<len;i++) 
16: { 
17:  if(!values[i].equalsIgnoreCase("")) 


Stacktrace: 
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 


root cause 

java.lang.NullPointerException 
    org.apache.jsp.SubmitMovie_jsp._jspService(SubmitMovie_jsp.java:67) 
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
+0

這是行67在堆棧跟蹤'org.apache.jsp.SubmitMovie_jsp._jspService(SubmitMovie_jsp.java:67)提到' –

回答

0

從堆棧跟蹤給定你得到NullPointerException

11: int id=Integer.parseInt(request.getParameter("rowId").trim()); 
12: int membid=0; 
13: String[] values=request.getParameterValues("memb"); 
14: int len=values.length; 
15: for(int i=0;i<len;i++) 
16: { 
17:  if(!values[i].equalsIgnoreCase("")) 

檢查幾件事情

  1. String數組values是不是您試圖訪問nullas values.length
  2. rowId始終不爲空,非空並存在於段落中儀表爲你解析它轉換成Integer