The web.xml web application descriptor file(描述文件) represents(代表) the core of the Java web application, so it is appropriate that it is also part of the core of the Struts framework. In the web.xml file, Struts defines its FilterDispatcher(控制器), the Servlet Filter class that initializes the Struts framework and handles(处理) all requests. This filter can contain initialization parameters that affect what, if any, additional configuration files are loaded and how the framework should behave.
In addition to(除..之外) the FilterDispatcher, Struts also provides an ActionContextCleanUp class that handles special cleanup tasks(特殊的清理任务) when other filters, such as those used by Sitemesh, need access to an initialized Struts framework.
- config - a comma-delimited list of XML configuration files to load.
- actionPackages - a comma-delimited list of Java packages to scan for Actions.
- configProviders - a comma-delimited list of Java classes that implement the ConfigurationProvider interface that should be used for building the Configuration.
- loggerFactory - The class name of the LoggerFactory implementation.
- * - any other parameters are treated as framework constants.
In the example above we've mapped the Struts 2 dispatcher to /*, so Struts 2 has a crack(入口) at all incoming(进来的) requests. This is because Struts 2 serves(提供) static content from its jar files, including Dojo JavaScript files (if using S2.0, or the Dojo plugin in S2.1+) and FreeMarker templates for the Struts 2 tags that produce HTML.
If we change the filter mapping to something else, for example/*.html, we must take this in to account and extract the content that would normally be served from the Struts 2 jar files, or some other solution.
Since Struts 2.1.7, you are able to provide a comma seperated list of patterns for which when matching against the
request URL the Filter will just pass by. This is done via the configuration option struts.action.excludePattern, for example in your struts.xml