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 #当出现非期望异常时,是否提交
本文详细介绍了Struts2框架中的配置选项,包括如何通过struts.properties和struts.xml文件进行常量配置,如开发模式、国际化设置、请求扩展等。
802

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



