`

Struts配置文件的优先级——常量配置

阅读更多

struts的常量配置可以在struts.xml、web.xml、struts.properties都可以。

例如在配置编码时:

1.struts.xml:

 

      <constant name=""struts.i18n.encoding" value="GBK"></constant>

 

2.struts.properties:

       

       struts.i18n.encoding = GBK

 

3.web.xml

    

     <filter>

           <filter-name>struts2</filter-name>

           <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

                <init-param>

                            <param-name>encoding</param-name>

                            <param-value>GBK</param-value>

                 </init-param>

     </filter>

     <filter-mapping>

           <filter-name>struts2</filter-name>

           <url-pattern>/*</url-pattern>

     </filter-mapping>

他们的优先级是:web.xml > struts.properties > struts.xml。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics