我有我的 doGet 为:
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException{
String resourceIDstr = request.getParameter("ResourceID");
int resourceID = Integer.valueOf(resourceIDstr);
Resource resourceToLend = ResourceModule.getInstance()
.getResourceByID(Integer.valueOf(resourceID));
request.setAttribute("resourceToLent", resourceToLend);
request.setAttribute("innerTab", "LendResource.jsp");
getServletConfig().getServletContext()
.getRequestDispatcher("/WEB-INF/jsp/admin/resourcelend.jsp")
.forward(request, response);
}
每当我将任何 GET 请求转发到此 servlet 时,它都不会将请求转发到 JSP,而是将异常抛出为:
HTTP Status 500 - org.apache.jasper.JasperException:
java.lang.NullPointerException
奇怪的是这个特定的 JSP 正被其他 servlet 使用而没有任何问题,并且这个特定的 servlet 抛出异常。我正在尝试查找异常的可能原因。
提前致谢。
更新:
org.apache.jasper.JasperException: org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
servlet.TempResourceLendServlet.doGet(TempResourceLendServlet.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
org.apache.jsp.WEB_002dINF.jsp.admin.resourcelend_jsp._jspService(resourcelend_jsp.java:114)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
servlet.TempResourceLendServlet.doGet(TempResourceLendServlet.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NullPointerException
org.apache.jsp.WEB_002dINF.jsp.admin.LendResource_jsp._jspService(LendResource_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
org.apache.jsp.WEB_002dINF.jsp.admin.resourcelend_jsp._jspService(resourcelend_jsp.java:114)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
servlet.TempResourceLendServlet.doGet(TempResourceLendServlet.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)