1、下载Eclipse Properties Editor,可协助你编写i18n的properties
http://propedit.sourceforge.jp/eclipse/updates/ (使用Eclipse的网络下载:
help à Software Updates à Find and Install à Search for new ……)
2、在struts-config.xml设定propeties文件的路径(要记得compile到WEB-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
分享到:
相关推荐
自己写的 本人也是刚刚接触struts2 所以写的东西比较适合刚刚接触struts2的新人。。
用MyEclipse工具实现的一个struts2国际化,用于刚接解struts2中i18n的同学学习。很好的代码,深入浅出。
基于Struts2技术的i18n,Web项目的国际化,能够生成,中,日,英三种语言
struts2国际化_i18n 完整实例。欢迎下载。
struts2 国际化 i18n struts2 国际化 i18n struts2 国际化 i18n
struts2i18n.rar struts2 i18n的实例, 环境是myeclipse6. struts2.16. struts国际化。
struts_I18N的包,已经用jar打包好了,直接用
struts1的国际化,里面主要就是简单的介绍了一下国际化如何使用。
NULL 博文链接:https://tianzhuowan.iteye.com/blog/1275521
struts1中实现了国际化(i18n)的登陆界面
NULL 博文链接:https://zhouxianglh.iteye.com/blog/521629
非常清晰可用的struts2 i18n国际化实例,非常适合初学者,不会让大家失望的,有问题还请求指教,大家互相学习,谢谢
一个超级简单的Struts2国际化demo
i18n Locale ResourceBundle MessageFormat 使用例子 在struts2学习开始前需要普及的知识点
博文链接:https://zhengdl126.iteye.com/blog/413021
struts2 中际化示例,加上s2sh所需的Jar就可以运行!如果不行留言,把demo发给你! 示例图:http://blog.csdn.net/liuc0317/archive/2010/12/01/6048552.aspx
根据不同的语言环境,读取不同的本地资源文件,自动实现本地化。
使用Struts 进行网页的国际化操作,实现国际化
NULL 博文链接:https://474802150.iteye.com/blog/2145744
国际化(i18n),struts 2实例,一步步教你如何实现一个示例