首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts2札记 - 05 指定Struts2处理的请求后缀及常量介绍

2012-10-11 
Struts2笔记 - 05 指定Struts2处理的请求后缀及常量介绍指定Struts2处理的请求后缀及常量介绍可以在struts

Struts2笔记 - 05 指定Struts2处理的请求后缀及常量介绍

指定Struts2处理的请求后缀及常量介绍

可以在struts.xml采用 struts.action.extension常量进行修改

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

?也可以指定多种后缀 可以采用,分割

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

struts.action.extension也可以定义在struts.properties中(不建议)

struts2加载常量的顺序
struts-default.xml
struts-plugin.xml
struts.xml
struts.properties
web.xml

如果在多个配置文件中都定义同一个常量则后面的常量值则会覆盖前面文件配置的常量值

■常用常量介绍

<!-- 指定默认编码集,作用于HttpServletRequest的setCharacterEncoding方法和freemarker,velocity的输出--><constant name="struts.i18n.encoding" value="utf-8"/><!-- 设置浏览器是否缓存静态内容 默认值为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"/><!--设置struts2是否支持动态方法调用,该属性的默认值是true.如果需要关闭动态方法调用则可设置为false--><constant name="struts.enable.DynamicMethodInvocation" value="false"/><!--上传文件的大小限制(总大小.默认为≤5MB)--><constant name="struts.multipart.maxSize" value="102400"/>

?

热点排行