5.struts2常量

   常量可以在struts.xml或struts.properties中配置,建议在struts.xml中配置,两种配置方式如下:

      1) 在struts.xml文件中配置常量:     

      <struts>      

        <constant name="struts.action.extension" value="do"/>

         </struts>

      2)在struts.properties中配置常量: (struts.properties文件放置在src下)     

      struts.action.extension=do.go

  常用常量:

<constant name="struts.i18n.encoding" value="UTF-8"/> //指定默认编码集,
<constant name="struts.action.extension" value="do"/> //该属性指定需要Struts 2处理的请求后缀,该属性的默认值是action
<constant name="struts.serve.static.browserCache" value="false"/>//设置浏览器是否缓存静态内容,默认值为true(生产环境下使用),开发阶段最好关闭 <constant name="struts.configuration.xml.reload" value="true"/>//当struts的配置文件修改后,系统是否自动重新加载该文件,默认值为false(生产环境下使用
<constant name="struts.devMode" value="true" />//开发模式下使用,这样可以打印出更详细的错误信息 <constant name="struts.ui.theme" value="simple" />//默认的视图主题 <constant name="struts.objectFactory" value="spring" />// 与spring集成时,指定由spring负责action对象的创建 <constant name="struts.enable.DynamicMethodInvocation" value="false"/>//该属性设置Struts2是否支持动态方法调用,该属性的默认值是true。
<constant name="struts.multipart.maxSize" value="10701096"/> //上传文件的大小限制
<constant name="struts.enable.SlashesInActionNames" value="true"></constant>////动态方法调用是否支持"/"默认不支持

 

posted @ 2013-02-13 17:13  一灵  阅读(138)  评论(0编辑  收藏  举报