首页 > 代码库 > j2ee之struts2的国际化数据方式
j2ee之struts2的国际化数据方式
和不用框架的时候一样,需要写你要改变的文字的配置文件(文件名_语言缩写_国家缩写.properties)
可以参考我之前写的j2ee之国际化数据方式
然后在struts.xml的配置文件中加入常量配置,如果不知道可以到源码的default.properties里面收索i18n关键字很快就可以找到
<struts> <constant name="struts.custom.i18n.resources" value="com.xinzhi.msg.msg"></constant> </struts>
最后在jsp页面中插入你写过的数据:关键代码:
<!-- 这是使用struts标签 --> <%@taglib uri="/struts-tags" prefix="s"%> <!-- 这是使用struts标签,调用配置文件中你写的要转换的文字 --> <s:text name="title"></s:text>
j2ee之struts2的国际化数据方式
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。