首先配置好struts2的过滤器:web.xml中的配置
<filter> <filter-name>struts-prepare</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts-prepare</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
然后在<url-pattern>/*</url-pattern>后加上
<dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher>
就可以了...