让Struts中的资源文件(ApplicationResources.properties)支持中文

首先要让jsp能正常显示中文,不然资源文件中是中文在页面还是乱码。在装有MyEclipse的情况下,可以进行如下操作:
Window - Preferences - MyEclipse - Files and Editors - JSP -Encoding 改为Chinsese, National Stardard,这样新建的jsp页面会自动加上 <%@ page language="java" pageEncoding="GB18030"%>,从而可以在页面上正常显示中文。手动修改pageEncoding="GB18030"也是一样的。

然后就是让Struts的资源文件支持中文,这里用到了一个插件:Properties Editor,安装过程如下:

[ INSTALLATION ]

Please choose from the screen of Eclipse with "Help" ->"Software Updates" -> "Update Manager". An 'Update Manager' opens.


In the "Feature Updates" view at the lower left of an 'Update Manager', please carry out the right click of the "Sites to Visit", and create a site bookmark by "New" -> "Site Bookmark...".
- The bookmark to create should input the following "URL" and should push an "Finish" button.
Name: Arbitrary input
URL : http://propedit.sourceforge.jp/eclipse/updates/
Bookmark type: Eclipse update site


If a site bookmark is created, the bookmark created at the bottom of "Feature Updates" will appear.
A click of "jp.gr.java_conf.ussiy.app.propedit.eclipse.feature.PropertiesEditorFeature x.x.x" displays a preview on a right window. Since the button "Install Now" is in around the lower right, please click.
具体用法可以参见 http://propedit.sourceforge.jp/index_en.html


Since an installation wizard starts, please click a "Next" button rapidly.


"You will need to restart the workbench for the changes to take effect. Would you like to restart now?" is displayed. Please reboot Eclipse according to a dialog.
安装成功后资源文件的图标就会变成绿色,资源文件的右键打开菜单多出来一项open with PropertiesEditor,用它打开时就可以直接在里面写入中文了,保存打开后还是中文,比较爽。想看看其他编码的形式就用其他的方式打开就可以了。

还有一个工具就是native2ascii,用法参见下面网址:
http://publib.boulder.ibm.com/html/as400/v4r5/ic2989/info/java/rzaha/javaapi/tooldocs/native2ascii.html
这个对已经写好了资源文件估计来的方便一点吧,一般还是用Properties Editor比较方便。
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值