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(由一个基于Web页面布局、装饰以及与现存Web应用整合的框架), need access(使用) to an initialized Struts framework.
Key Initialization Parameters
-
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.
Why the Filter is mapped with /* and how to configure explicit exclusions (since 2.1.7)
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框架。主要由三大模块组成:Core、Dijit、DojoX) JavaScript files (if using S2.0, or the Dojo plugin in S2.1+) and FreeMarker(一个模板引擎,一个基于模板生成文本输出的通用工具,使用纯Java编写) 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.
<struts>
<constant name="struts.action.excludePattern" value=".*unfiltered.*,.*\\.nofilter"/>
...
</struts>
分享到:
相关推荐
struts1 web.xml struts1配置
struts.xml和applicationContext.xml、web.xml的配置
spring在web.xml中和在struts中的不同配置..pdf
以前和struts2一起使用的配置文件,struts2的核心控制器
struts2.5 web.xml配置
javaweb项目中web.xml的作用 web.xml是javaweb项目中一个非常重要的配置文件,它是每一个javaWeb工程都必需的配置文件。web.xml文件的主要作用是用于初始化工程配置信息,例如welcome页面、filter、listener、...
flex4,struts2.3兼容配置web.xml
flex4,struts2.3兼容配置web.xml中的filter
使用myeclipse8.5搭建SSH后,将struts.xml和applicationContext.xml移动到别的地方,示例中为webroot下的config文件夹中,web.xml中需要做的修改示例。其中对于返回上一层方式不同的myeclipse可能不同,如有的用../...
Struts2手动搭建“所有的jar包(全)”及相应的struts.xml和web.xml全套
Web.xml中配置Struts[文].pdf
Web.xml中配置Struts[参考].pdf
struts-web.xml
Struts-config.xml 配置文件详解 Struts-config.xml 是 Struts 框架的主要配置文件,用于配置 Struts 应用程序的...通过了解 Struts-config.xml 文件的结构和配置方式,可以更好地使用 Struts 框架开发 Web 应用程序。
这份文件 把javaEE 中web.xml中的基本配置都 写在里面了
4. struts.configuration.xml.reload:这是一个布尔值,用于确定是否加载XML配置文件。如果设置为true,Struts2将加载XML配置文件;否则,不加载。 5. struts.continuations.package:这是一个包名,包含使用Rife ...
主要给大家介绍了关于Struts2.5版本中struts.xm与web.xml配置的更改方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
本文档详细讲解了关于web工程中web.xml文件相关配置;希望对web开发者有一定的帮助。
struts2所需的jar+struct.xml+web.xml+jdbc.java
spring在web.xml中和在struts中的不同配置.[收集].pdf