当前位置: 代码迷 >> JavaScript >> jsp报java.lang.NullPointerException错误
  详细解决方案

jsp报java.lang.NullPointerException错误

热度:737   发布时间:2012-10-31 14:37:31.0
jsp报java.lang.NullPointerException异常
点击下面标题查看本文完整版:jsp报java.lang.NullPointerException异常

org.apache.jasper.JasperException
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.NullPointerException
org.apache.jsp.queryJavaBeanJsp_jsp._jspService(queryJavaBeanJsp_jsp.java:90)
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)



------解决方法--------------------
在servlet中做判断大致如下:
if(Object==null)
request.getRequestDispatcher("xx.jsp").forward(request,response);
//xx.jsp是向sevrlet提交的页面
------解决方法--------------------
到tomcat的work目录找到queryJavaBeanJsp_jsp.java,打开这个java文件,移到第90行,看看jsp文件编译后java代码,查看是否你写的哪个对象没有进行NullPointerException处理,回到jsp页去找到这个对象。

    
  相关解决方案