我无法使用RequestDispatcher向前调用JSP
我有这个servlet调用这个JSP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
%>
</body>
</html>
但不知道为什么这给了我这个错误
2011年9月10日下午4时15分23秒org.apache.catalina.core.StandardWrapperValve调用SEVERE:Servlet.service()为servlet测试抛出异常java.lang.NullPointerException在org.apache.jsp.Mine_jsp._jspInit(Mine_jsp。 java:22)at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)at org.apache.jasper.servlet .JspServletWrapper.service(JspServletWrapper.java:338)在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)在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain。 java:206)at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)at org.apache.catalina.core.ApplicationDispatcher.d o在javax.servlet.http.HttpServlet.service上的Test.doGet(Test.java:31)处的org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)处包含(ApplicationDispatcher.java:551)(HttpServlet的.java:617)在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)在org.apache.catalina.core。 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)在组织.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve .java:109)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)at org.apache.coyot e.http11.Http11Processor.process(Http11Processor.java:859)在org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:588)在org.apache.tomcat.util.net.JIoEndpoint $工人。在java.lang.Thread.run(Thread.java:619)运行(JIoEndpoint.java:489)
java.lang.NullPointerException在org.apache.jsp.Mine_jsp._jspInit(Mine_jsp.java:22)
当webapp的/WEB-INF/lib
文件夹被诸如jsp-api.jar
, j2ee.jar
等等特定于servletcontainer的库散布时, _jspInit()
上的NPE是典型的。 这是一个重大的错误,这些图书馆属于servletcontainer一方。 清理你的/WEB-INF/lib
文件夹以将它们全部删除。 如果你把它们放在那里来克服编译错误,你应该以不同的方式解决它。 另请参见如何在Eclipse项目中导入javax.servlet API?
上一篇: I am unable to call a JSP using RequestDispatcher forward
下一篇: "NoClassDefFoundError: Could not initialize class" error