网站首页 新闻首页 网页设计图形动画软件编程网站开发办公软件操作系统数据库网络技术认证考试范文资料黑客攻防 书籍教程 进入论坛

在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" /> 

欢迎光临DIY部落,点击这里查看更多文章教程   【点击打包该文章】
如果图片或页面不能正常显示请点击这里 站内搜索:   

文章评论

请您留言