struts2国际化资源的配置

来源:互联网 发布:淘宝大头十字绣 编辑:程序博客网 时间:2024/05/16 08:17

1.

在struts.xml中配置如下

<struts>

<constant name="struts.custom.i18n.resources" value="messageResource"/>

</struts> 对应的文件名,mesageResource_xx_xx.properties 如messageResource_zh_CN.properties

2

在web.xml中配置

在过滤器中配置
<filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>

        <init-param>
            <param-name>struts.custom.i18n.resources</param-name>
            <param-value>mesageResource</param-value>
        </init-param>
    </filter>

....

对应的文件同上,尽量把关于struts属性的东西配置到struts.xml中,这样在整合时好调试

原创粉丝点击