default.properties 该文件保存在 struts2-core-2.3.7.jar 中 org.apache.struts2包里面
struts-default.xml 该文件保存在 struts2-core-2.3.7.jar
struts-plugin.xml 该文件保存在struts-Xxx-2.3.7.jar
struts.xml 该文件是web应用默认的struts配置文件
struts.properties 该文件是Struts的默认配置文件
如果多个文件配置了同一个struts2 常量,则后一个文件中配置的常量值会覆盖前面文件配置的常量值
二、default.properties定义了struts2 框架的大量常量,开发者可以通过改变这些常量来满足应用的需求
<constant name="struts.devMode" value="true" />
指定默认编码集,作用于HttpServletRequest的setCharacterEncoding方法 和freemarker 、velocity的输出
<constant name="struts.i18n.encoding" value="UTF-8"/>
该属性指定需要Struts 2处理的请求后缀,该属性的默认值是action,即所有匹配*.action的请求都由Struts2处理。
如果用户需要指定多个请求后缀,则多个后缀之间以英文逗号(,)隔开
<constant name="struts.action.extension" value="action"/>
设置浏览器是否缓存静态内容,默认值为true(生产环境下使用),开发阶段最好关闭
<constant name="struts.serve.static.browserCache" value="false"/>
当struts的配置文件修改后,系统是否自动重新加载该文件,默认值为false(生产环境下使用),开发阶段最好打开
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.devMode" value="true" />
<constant name="struts.ui.theme" value="simple" />
与spring集成时,指定由spring负责action对象的创建
<constant name="struts.objectFactory" value="spring" />
该属性设置Struts 2是否支持动态方法调用,该属性的默认值是true。如果需要关闭动态方法调用,则可设置该属性
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<constant name="struts.multipart.maxSize" value=“10701096"/>
四、在大部分应用里,随着应用规模的增加,系统中Action的数量也会大量增加,导致struts.xml配置文件变得非常臃肿。
为了避免struts.xml文件过于庞大、臃肿,提高struts.xml文件的可读性,我们可以将一个struts.xml配置文件分解成多个配置文件,
下面的struts.xml通过<include>元素指定多个配置文件:
<include file="struts-part1.xml"/>
<include file="struts-part2.xml"/>

7510

被折叠的 条评论
为什么被折叠?



