处理JSP页面和jsp:include时发生异常

时间:2017-02-20 08:06:36

标签: java jsp servlets

我在主jsp页面上有web.xml和servlet-mapping。

<servlet>
    <servlet-name>Catalog</servlet-name>
    <jsp-file>/WEB-INF/views/catalog.jsp</jsp-file>
</servlet>

<servlet-mapping>
    <servlet-name>Catalog</servlet-name>
    <url-pattern>/catalog</url-pattern>
</servlet-mapping>

这个jsp有jsp:include标签,带有header.jsp的路径

但是当服务器正在运行时,我会看到此错误消息。

20-Feb-2017 01:11:40.845 SEVERE [http-apr-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Catalog] in context with path [] threw exception [An exception occurred processing JSP page /WEB-INF/views/catalog.jsp at line 4

20-Feb-2017 13:12:31.207 SEVERE [http-apr-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [catalog] in context with path [] threw exception [An exception occurred processing JSP page /WEB-INF/views/catalog.jsp at line 4

1: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2: <%@ page contentType="text/html; charset=utf-8" %>
3: 
4: <jsp:include page="../views/header.jsp"/>
5: 
6:         <div class="container content-wrapper">
7:             <div class="row"><


Stacktrace:] with root cause
 java.lang.NullPointerException
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:935)
at org.apache.jsp.WEB_002dINF.views.catalog_jsp._jspService(catalog_jsp.java:122)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

0 个答案:

没有答案