1.web.xml加载struts框架即过滤器,要注意struts版本不同过滤器配置也不同。
1 <!DOCTYPE web-app PUBLIC 2 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 3 "http://java.sun.com/dtd/web-app_2_3.dtd" > 4 5 <web-app> 6 <display-name>Archetype Created Web Application</display-name> 7 8 <filter> 9 <filter-name>struts2</filter-name> 10 11 <filter-class> 12 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 13 </filter-class> 14 15 <init-param> 16 <param-name>config</param-name> 17 <param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value> 18 </init-param> 19 </filter> 20 21 <filter-mapping> 22 <filter-name>struts2</filter-name> 23 <url-pattern>/*</url-pattern> 24 </filter-mapping> 25 26 <welcome-file-list> 27 <welcome-file>login.jsp</welcome-file> 28 </welcome-file-list> 29 30 </web-app>