application_zh_CN.properties 需要转换的。
native2ascii ApplicationResources_temp.properties ApplicationResources_zh_CN.properties把现在CN中的内容放到一个temp中,转换后就行了。
native2ascii ApplicationResources_temp.properties ApplicationResources_zh_CN.properties把现在CN中的内容放到一个temp中,转换后就行了。
然后在struts的配置文件struts-config.xml中配置你经过转码的资源文件,具体的就是修改配置文件中的message-resources项为:<message-resources parameter="yourpackage.ApplicationResources_CN" />注意struts中的资源文件是做为一个类文件对待的,所以在你对web项目增加struts支持的时候会让你指定资源文件的包名,上面的yourpackage就是你给资源文件指定的包名。
application_zh_CN.properties 需要转换的。
native2ascii ApplicationResources_temp.properties ApplicationResources_zh_CN.properties把现在CN中的内容放到一个temp中,转换后就行了。
-----------------------------------------------
没错。
用jbuilder2005能完成编码转换吗。还有是不是搞顶了,在xml文件中 就有两个:<message-resources parameter="" /> 一个是中文的,一个是英文的呢。是这样的吗。
:不是的,struts会跟据本地的信息自动查找,以中文为例:它会先找XXX_zh_CN,然后找XXXX_CN,然后你是XXXX(XXXX为你在message-resources中指定的资源文件名,一般为英文),
看你的其它地方用了没有用。
用<bean:message key="">标签可以在页面上显示出ApplicationResources.properties文件中的内容,当然,这些信息是英文的。。在这个基础上,其他任何地方都不动修改。。在tomcat下是可以成功运行显示的。然后,我建立了个app.properties内容如下:
hello.tit=你好
hello.bo=学学
接着,我编写了个.bat文件,内容如下:
native2ascii -encoding gb2312 app.properties application_zh_CN.properties
成功的把app.properties 转换成application_zh_CN.properties文件,就这样,我拿到tomcat下运行,根本就找不到资源。