1.
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 5 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 6 <filter> <!--定义核心Filter FilterDispatcher --> 7 <filter-name>struts2</filter-name> <!-- 定义核心Filter的名称 --> 8 <filter-class> <!--定义核心Filter的实现类 --> 9 org.apache.struts2.dispatcher.FilterDispatcher 10 </filter-class> 11 </filter> 12 <filter-mapping> 13 <filter-name>struts2</filter-name><!--核心Filter的名称 --> 14 <url-pattern>/*</url-pattern><!--使用该核心Filter过滤所有的Web请求 --> 15 </filter-mapping> 16 </web-app>