首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

struts2 国际化,批改本地语言

2013-10-29 
struts2 国际化,修改本地语言先在struts.xml中引入constant namestruts.custom.i18n.resources value

struts2 国际化,修改本地语言

先在struts.xml中引入

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

然后在src目录下创建 international_zh_CN.properties 文件名格式为:名字_语言_国家.properties

然后页面使用方式。

在页面使用struts标签如:<s:text name="name"/>


如果要测试的话,有两种方式。一种是修改本地语言,控制面板-区域-位置,然后设置语言

还有一种动态修改语言:修改session中 WW_TRANS_I18N_LOCAL 这常量值。如:request.getSession().setAttribute("WW_TRANS_I18N_LOCALE",Locale.US);

热点排行