struts2.1.6 I18N 08
来源:互联网 发布:网络百家家乐怎样作假 编辑:程序博客网 时间:2024/06/11 09:42
I18N
1. I18N原理
a) ResourceBundle和Locale的概念
b) 资源文件
c) native2ascii
2. Struts的资源文件
a) Action – Package – App级
b) 一般只用APP
i. struts.xml custom.i18n
c) PropertiesEditor插件
i. 解压
ii. features plugin 覆盖到myeclipse中的eclipse目录里
d) 动态语言切换
i. request_locale=en_US
一般大型网站用到,主要用于网站语言之间切换
<body> <form action="admin/Login_login" method="post"> <s:property value="getText('login.username')"/> <input name="username"/> <s:property value="getText('login.password')"/><input name="password" type="password" /> <input type="submit" value="<s:property value="getText('login.login')"/>" /> </form> <s:debug></s:debug> </body>
<body>欢迎你: <s:property value="username"></s:property><s:debug></s:debug> </body>
struts 国际化推荐如下方法:
import java.util.Locale;import java.util.ResourceBundle;public class Test {public static void main(String[] args) {ResourceBundle rb = ResourceBundle.getBundle("app",Locale.CHINA);System.out.println(rb.getString("welcome.msg"));}}app_zh_CN.properties 文件里面 welcome.msg=CHIANapp_en_US.properties 文件里面 welcome.msg=hell,miss
浏览器语言设置,要经过【上移】 到顶端才起作用
设置语言运行结果如下图
com.opensymphony.xwork2
\struts-2.1.6\docs\xwork-apidocs\index.html
文件字符编码设置 点击 other 设置
http://localhost:8080/Struts2_32_BBS2011_I18N_2/admin/Login_input?request_locale=en_US 在地址栏 动态语言切换 编程英文
中英文切换
<a href="admin/lang?request_locale=en_US">en</a> <a href="admin/lang?request_locale=zh_CN">zh</a>
- struts2.1.6 I18N 08
- struts2.1.6 I18N 08
- Struts2---->I18N
- struts2 i18n
- struts2 国际化 i18n
- struts2——i18n!!!
- struts2 i18n (一)
- Struts2 i18n(二)
- Struts2 i18n(三)
- struts2 i18n 原理
- struts2 i18n国际化问题
- Struts2之I18N
- I18N与Struts2
- struts2的国际化i18n
- Struts2国际化详解 i18n
- Struts2国际化标签 i18n
- struts2 国际化 I18N
- struts2 I18N(8)
- 夜很长,人难眠
- struts2.1.6 Exception 08
- EXT3与EXT4的主要区别
- 杭电 3829 多校联合赛 二分图
- 读书时间 2011/11/17
- struts2.1.6 I18N 08
- 98. Chose an author as you chose a friend. 择书如择友
- 图片批量滚动
- 硅谷为什么会出现如此多的科技企业
- Linux 的shell编程
- ubuntu11.04之旅
- 分享爱情
- VS2010/VS2005/VS频繁出现爆掉是什么原因呢?
- 深入理解Javascript闭包(closure)