struts2的国际化说明
来源:互联网 发布:红色管弦乐 知乎 编辑:程序博客网 时间:2024/06/07 12:42
struts2的国际化支持还是比较简单的,如下说明:
1、在struts.xml配置文件中配置国际化的资源文档,如我们的资源文档叫message_en_US.properties和message_zh_CN.properties,放到src下的,我们就可以这样配置:
<constant name="struts.custom.i18n.resources" value="<span style="color:#ff0000;"><strong>message</strong></span>"></constant>
message_en_US.properties和message_zh_CN.properties中存放的都是键值对,此处就不多讲了;
使用struts2的标签库,此处要注意:因为使用的是struts2的标签库,所以必须是经过struts2过滤处理后转向的页面才会有,否则会报未过滤的错误!
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
在页面引入标签:
<%@ taglib uri="/struts-tags" prefix="s"%>
在文档中使用:
<s:text name="hello"></s:text>
3、在action中使用
这个地方比较简单,直接使用集成的父类ActionSupport中的方法getText()就可以了:
System.out.println(this.getText("hello"));
0 0
- struts2的国际化说明
- Struts2国际化详细配置说明
- 国际化与Struts2的国际化
- Struts2的国际化
- 畅所欲言struts2的国际化
- struts2的国际化
- Struts2的国际化
- Struts2的国际化支持
- Struts2的国际化支持
- struts2 的国际化支持
- Struts2的国际化
- struts2 的国际化支持
- Struts2 的国际化
- struts2的国际化
- struts2 的国际化支持
- Struts2的国际化
- struts2的国际化标签
- struts2的国际化标签
- Android中颜色的表示
- 第九周项目三信号图(c图)
- web的自动化发布
- Java网页资源抓取例子(使用第三方包Jsoup解析Html)
- 【水模拟】#71 A. Bus Game
- struts2的国际化说明
- ListView下拉刷新的实现
- 假设有五个IP地址A:131.107.256.80,B:231.222.0.11,C:126.1.0.0,D:198.121.254.255,E:202.117.34.32,找出不能分配给主机的IP地
- 图片分享与防盗链
- Mysql Too many connections问题
- 诺基亚2016年会重返智能手机市场?
- Hadoop storm知识
- 第9周项目6还原等式(1)
- Python笔记之网络编程