在Struts中资源文件的中文显示
http://www.diybl.com/ 2008-3-11 网络 点击:
[ 评论 ]
文章搜索:
【点击打包该文章】
例如: WEB-INF\classes目录下有资源文件ApplicationResources_zh.properties
ApplicationResources_zh.properties文件的内容:
error.username.required=<font color="red">请输入用户名!</font>
error.password.required=<font color="red">请输入密码!</font>
进入dos环境,进入ApplicationResources_zh.properties文件所在的目录,输入转化的命令:
native2ascii -encoding GB2312 ApplicationResources_zh.properties ApplicationResources_
zh_CN.properties
转化后将在同目录下生成资源文件ApplicationResources_zh_CN.properties
ApplicationResources_zh_CN.properties的内容为:
error.username.required=<font color="red">\u8bf7\u8f93\u5165\u7528\u6237\u540d!</font>
error.password.required=<font color="red">\u8bf7\u8f93\u5165\u5bc6\u7801!</font>
修改struts-config.xml的message-resources为:
<message-resources parameter="ApplicationResources_zh_CN" />
如果图片或页面不能正常显示请点击这里 站内搜索:
推荐文章 |
