问题描述
小弟最近将struts2和urlrewriter进行了整合,相关的配置文件如下URLRewiter <filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class> org.tuckey.web.filters.urlrewrite.UrlRewriteFilter </filter-class> </filter> <filter-mapping> <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>struts2 <filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern><dispatcher>FORWARD</dispatcher><dispatcher>REQUEST</dispatcher><dispatcher>INCLUDE</dispatcher> </filter-mapping>但是问题出现了:我在跳转以后的页面中用 <s:include> 引入了另一个封装了分页操作的页面(用的自定义标签处理分页),当按照上面的配置完成后,就会出现如下错误:java.lang.NullPointerExceptionat org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)at org.apache.jsp.system.navigation.list_jsp._jspx_meth_s_005fhidden_005f0(list_jsp.java:506)at org.apache.jsp.system.navigation.list_jsp._jspService(list_jsp.java:126)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)但是当将web.xml中 <dispatcher>INCLUDE</dispatcher> 去掉,就不会报错,但是在include的页面里面得不到action stack 里面的值。希望大家指教。 问题补充:fxmabo 写道
解决方案
这个问题应该出在你的list.jsp的分页包含中,那个里面某个字段的取值范围不对,取到的对象为空。你仔细看看那块,如果你没找到,把list.jsp的代码发来看看。