`
liuxi1024
  • 浏览: 385489 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Struts实作i18n

 
阅读更多

1、下载Eclipse Properties Editor,可协助你编写i18nproperties
http://propedit.sourceforge.jp/eclipse/updates/ (使用Eclipse的网络下载:
help à Software Updates à Find and Install à Search for new ……)

 

2、在struts-config.xml设定propeties文件的路径(要记得compileWEB-INF/classes)

<message-resources parameter="ApplicationResource" null="true" />

如果语系设定为中文(台湾) : ApplicationResource_zh_TW.properties
如果语系设定为中文(中国) : ApplicationResource_zh_CN.properties
如果没有对应的语系,则会读取ApplicationResource.properties

 

3、properties檔是依照key = value去区分的,如果有相同的key,则会读取最后面的

test.name=张三

test.name=李四

 

4、IE设定语系:工具à因特网选项à语言


 

5、使用方式:

 

ActionMessage

     

html:errors

ActionMessages msgs = new ActionMessages();
msgs.add("message", new ActionMessage("success.data.add"));

super.saveErrors(request, msgs);

<html:errors/>

<bean:message …./>

<bean:message key="employee.chinese.name"/>

ActionMessage

     

html:messages

bean:write

ActionMessages msgs = new ActionMessages();

msgs.add("message", new ActionMessage("success.data.add"));

super.saveMessages(request, msgs);

<html:message id=”msg” message=”true”>

  <bean:write name=”msg” />

</html:message>

  • 大小: 15.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics