Struts2中有个文件struts.properties放在src下面,该文件中可以放很多像键值对的字符串,这些都是类似常量,所以也可以在xml中进行常量配置,例如:
struts.devMode可以在struts.properties中配置:
struts.devMode = false
也可以在struts.xml中配置
<struts>
<
constant
name
=
"struts.devMode"
value
=
"true"
/>
</struts>
struts.locale=en_US #设置本地语言
struts.i18n.encoding=UTF-8 #设置编码
struts.action.extension=action,do, #设置请求的后缀,struts2一般默认为action
struts.serve.static=true #如果值为true时,常量中jar包中引入,如果为false,常量值要在struts文件中定义
struts.enable.DynamicMethodInvocation = false #是否支持动态请求方法映射,例如:such as <action name="*/*" method="{2}" class="actions.{1}">
struts.devMode = false #是否启动开发模式,便于调试,如果设置true,说明每次修改struts.xml文件,不需要重新部署
struts.ognl.allowStaticMethodAccess=false #在OGNL中是否支持静态方法访问
struts.handle.exception=true #当出现非期望异常时,是否提交