假设你的属性文件名为ApplicationResources.properties,再建一个名为ApplicationResources_ISO.properties的文件,将要显示的中文全放在ApplicationResources_ISO.properties文件中,ApplicationResources.properties中空白,
然后,把两个文件放在同一目录下,用jdk的native2ascii命令
C:\>native2ascii -encoding gb2312 ApplicationResources_ISO.properties  ApplicationResources.properties
该命令的作用是将ApplicationResources_ISO.properties中的中文转换成正则表达式,并将其输入到ApplicationResources.properties中。
然后将ApplicationResources.properties文件拷贝到相应的目录即可。

解决方案 »

  1.   

    新建两个类:GBKPropertyMessageResources、GBKPropertyMessageResourcesFactorypackage my.util;
    import org.apache.struts.util.*;
    import java.util.Locale;
    import java.io.*;public class GBKPropertyMessageResources extends PropertyMessageResources {
      public GBKPropertyMessageResources(MessageResourcesFactory factory,
                                      String config) {
          super(factory, config);
      }  public GBKPropertyMessageResources(MessageResourcesFactory factory,
                                      String config, boolean returnNull) {      super(factory, config, returnNull);
      }  public String getMessage(Locale locale, String key) {
          String msg = super.getMessage(locale, key);
          if(null == msg || msg.length() < 1) {
              return msg;
          }
          try {
              return new String(msg.getBytes("ISO-8859-1"), "GBK");
          }
          catch (UnsupportedEncodingException ex) {
              return null;
          }
      }}package my.util;
    import org.apache.struts.util.*;public class GBKPropertyMessageResourcesFactory extends PropertyMessageResourcesFactory {
      public MessageResources createResources(String config) {
          return new GBKPropertyMessageResources(this, config, this.returnNull);
      }
    }然后在strust-config中配置
    <message-resources factory="my.util.GBKPropertyMessageResourcesFactory" parameter="ApplicationResources" />即可!
      

  2.   

    来晚了
    就是用native2ascii这个命令一转就可以了
      

  3.   

    就是,用 native2ascii 命令,非常方便
      

  4.   

    能不能具体说明一下native2ascii 命令如何使用
      

  5.   

    native2ascii source.properties target.properties
      

  6.   

    转码,具体的与我联系[email protected]