首页 新闻 会员 周边

使用Struts标签进行页面国际化出现的难题,望解答....

0
悬赏园豆:5 [待解决问题]

使用Struts标签进行页面国际化的过程,

1、定义Struts的资源文件

<message-resources parameter="com.demo.struts.resources.ApplicationResources" />

2、创建Struts资源文件

ApplicationResources.properties

ApplicationResources_zh_CN.properties

3、定义jsp页面的字符集合

//ApplicationResources.properties

label.username=USERNAME:
label.password=PASSWORD

//ApplicationResources_zh_CN.properties

label.username=\u7528\u6237\u540d:
label.password=\u5bc6\u7801:

4、在jsp页面获取资源文件里面的内容

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>

//输出:

<table>
<tr>
<td align="right"><bean:message key="label.username" bundle="com.demo.struts.resources.ApplicationResources_zn_CN.properties"/></td>
</tr>
<tr>
<td align="right">&nbsp;<bean:message key="label.password"/></td>
</tr>
<%
out.println("language: ");
out.println(request.getLocale());
%>
</table>

5、用IE浏览器进行访问时,无法显示需要的结果:

即我的IE语言首选项是中文的话,IE显示的是中文;

我的IE语言首选项是英文的话,IE还是显示中文;

这个问题小弟百般无奈,希望能得到高手指点一二,小弟万般感激...

王子泰的主页 王子泰 | 初学一级 | 园豆:200
提问于:2011-09-23 10:35
< >
分享
所有回答(1)
0

问题已解决...谢谢..!

王子泰 | 园豆:200 (初学一级) | 2011-09-23 11:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册