国际化资源文件配置

1、对于struts2来说
在struts.properties文件中找到struts.custom.i18n.resources,将其值设置为如下:
com.struts2.resources.ApplicationResources

这时,在包com.struts2.resources下面建立资源文件,文件名为如下形式:
ApplicationResources_zh_CN.properties
ApplicationResources_en_US.properties

这样就可以使用这两个资源文件了

2、对于struts1来说,配置资源文件的方式为,在struts-config.xml文件中添加如下的代码:
<message-resources parameter="com.demo.struts.resources.ApplicationResources" />


这样就可以将资源文件放在包com.demo.struts.resources下,并且资源文件名的格式

为:ApplicationResources_zh_CN.properties或ApplicationResources_en_US.properties

猜你喜欢

转载自yangjianzhouctgu.iteye.com/blog/1669557