struts2常量配置
1.在struts.xml中配置。
例如:
<struts>
<constant name="struts.custom.il8n.resources" value="messageResource" />
</struts>
2.在struts.properties中配置,该文件的内容就是系列的key-value对。
例如:
struts.devMode=true //指定了struts2应用处于开发阶段
3.在web.xml中配置struts2常量,可以通过<filter>元素的<init-param>子元素指定。
例如:
<filter>
<!-- 指定struts2的核心Filter -->
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<!-- 通过init-param初始化struts2常量 -->
<init-param>
<param-name>struts.custom.il8n.resources </param-name>
<param-value>messageResource </param-value>
</init-param>
</filter>
推荐在struts.xml中配置常量