strtus中文处理

struts1.2.4+eclipse2.1+tomcat5.0.*+mysql4.0.2?+easystrtus0.6.4

首先在eclpise中设置默认编码是utf-8:window->preference->workbench->editors->textfileencoding.

利用easystruts建立国际化资源文件(中文):new/select->java->easystruts->easymessageresource/next->key(org.apache.struts.action.MESSAGE_zh_CN),parammeter(com.yourcompany.struts.ApplicationResources_zh_CN), 然后就可以在ApplicationResources_zh_CN.properties中输入各种本地化信息。 最后执行命令native2ascii -encoding utf-8 ApplicationResources_zh_CN.properties, 并将屏幕上显示的内容复制覆盖ApplicationResources_zh_CN.properties原来的内容。

数据库则只需将连接url写成:jdbc:mysql://localhost/mydatabase?user=yourusername&password=yourpassword&useUnicode=true&characterEncoding=utf-8
posted on 2005-05-21 09:53  dbzou  阅读(390)  评论(0编辑  收藏  举报