ITeye博客

struts2的常量

沐雨川 · 2014-09-14 18:33 · Struts2学习 · 编程语言 · Markdown

常亮定义:
因为常量可以在下面多个配置文件中进行定义,所以我们需要了解struts2加载常量的搜索顺序:
struts-default.xml
struts-plugin.xml
struts.xml
struts.properties
web.xml
如果在多个文件中配置了同一个常量,则后一个文件中配置的常量会覆盖前面文件中配置的。

 

一些常用的常量:
<!-- 指定默认编码值,作用于HttpServletRequest的setCharacterEncoding方法和freemarker、velocity的输出 -->
 <constanst name="struts.i18n.encoding" value="utf-8"/>
<!-- 当struts的配置文件修改后,系统是否自动重新加载该文件,默认为false(生产环境下使用),开发阶段最好打开 -->
 <constanst name="struts.configuration.xml.reload" value="true"/>
<!-- 默认的视图主题 -->
 <constanst name="struts.ui.theme" value="simple"/>
<!-- 与spring集成时,指定由spring负责action的创建 -->
 <constanst name="struts.objectFactory" value="spring"/>
<!-- 该属性设置struts2是否支持动态方法调用,默认设置为true。 -->
 <constanst name="struts.objectFactory" value="spring"/>
<!-- 上传文件大小的限制 -->
 <constanst name="struts.multipart.maxSize" value="10701096"/>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。