Struts常量的覆蓋配置
在struts.xml中覆蓋常量
使用<constantname="" value=""></constant>元素進行覆蓋。如下:
<constan t name="struts.action.extension" value="do"></constant>
在struts.properties中覆蓋常量
在struts.properties中的體現形式都是key=value。如下:
struts.devMode=true
struts.action.extension=do
在web.xml中覆蓋常量
在web.xml中配置常量時,需要將其配置在過濾器的初始化參數中。如下:
<filter>
<filter-name>struts2<filter-name>
<filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.action.extension</param-name>
<param-value>do</param-value>
</init-param>
</filter>