因为中文环境和英文环境下所需要的properties文件的文件名不一样

解决方案 »

  1.   

    把该文件转换成unicode编码格式,可用jdk自带的工具转换
      

  2.   

    to  qdstar(大鸟) 那页面还需要加上<%@ page contentType="text/html;charset=gb2312%>吗?为什么我一用<%@ page contentType="text/html;charset=gb2312%>就会产生错误:
    A Servlet Exception Has Occurred
    org.apache.jasper.compiler.ParseException: /project/addproject.jsp(4,19) Attribute  has no value
    at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)
    at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:681)
    at org.apache.jasper.compiler.ParserController.figureOutJspDocument(ParserController.java:265)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:194)
      

  3.   

    to  qdstar(大鸟) :上面的回复是我的语法错误导致,请不必看我是这样理解的,ApplicationResources.properties和ApplicationResources_zh.properties同时存在,页面根据<%@ page contentType="text/html;charset=gb2312%>来判断显示那种语言,是这样吗?
      

  4.   

    ApplicationResources_zh.properties文件中的键名是否应该是:project.add=添加项目  用project_add当然找不到。
      

  5.   

    <%@ page contentType="text/html;charset=gb2312%> 写错了
      

  6.   

    吧你的ApplicationResources_zh.properties里面的中文线转换成unicode嘛,就可以了
      

  7.   

    Struts1.1b2的例子中的本国资源文件经过Unicode编码的,所以你如果要和它的运行一样,也必须将你的ApplicationResources_zh进行Unicode编码。使用jdk的native2ascii工具。 native2ascii 功能说明:将含有本地编码字符(既非 Latin1 又非 Unicode 字符)的文件转换为 Unicode 编码字符的文件。语法:native2ascii [options] [inputfile [outputfile]]补充说明:Java 编译器和其它 Java 工具只能处理含有 Latin-1 和/或 Unicode 编码(udddd 记号)字符的文件。native2ascii 将含有其它字符编码的文件转换成含 Latin-1 和/或 Unicode 编码字符的文件。若省略 outputfile,则使用标准输出设备输出。此外,如果也省略 inputfile,则使用标准输入设备输入。 命令选项-reverse 执行相反的操作:将含 Latin-1 和/或 Unicode 编码字符的文件转换成含本地编码字符的文件。-encoding[encoding_name] 指定转换过程使用的编码名称。缺省的编码从系统属性 file.encoding 中得到。 3.应用实例:native2ascii -encoding GBK ApplicationResources.properties ApplicationResources_zh_CN.properties 
    我的做法:
    1、将存有英文信息的ApplicationResource.properties复制一份,重命名为a(为了减少dos命令的长度);
    2、使用Editplus编辑文件a,写入中文信息;
    3、在Dos窗口中,切换到文件a所在目录,运行:
    native2ascii a ApplicationResource_zh.properties
      

  8.   

    native2ascii -encoding gb2312 ApplicationResources_zh.properties 来将中文转换为unicode编码。
      

  9.   

    同意楼上的,如果你的机器装了jdk,那么在命令窗口调用命令:
    native2ascii ApplicationResources_zh.properties tmp.txt
    tmp.txt里边就是unicode编码,用这些编码替换中文就行了