在jsp程序的第一行加入:
<%@page contentType="text/html;charset=gb2312"%>

解决方案 »

  1.   


    getBytes("iso-8859-1"),"gb2312"
    试试。
    应该是编码的问题。
      

  2.   

    给你一个函数:
    /**** 字符集的转换函数 ****/
            // added by baiqing 2003.02.18
            public static String charConvert(String strSource){
                if (strSource == null){
                    return "";
                }
                else{
                    try{
                      //return new String(strSource.getBytes("GB2312"), "ISO-8859-1");
                      String str = new String(strSource.getBytes("iso-8859-1"), "GB2312");
                      System.out.println(str);
                      return str;
                    }
                    catch (Exception ex){
                      System.out.println(ex.toString());
                      return "";
                    }
                }
            }
      

  3.   

    可以通过servlet filter的方式(一般像tomcat的应用程序服务器用的是iso-8859-1编 码) 在tomcat目录下/wepapps/examples/WEB-INF/classes/filters有一个文件SetCharacte rEncodingFilter.class copy到你的classes/filters目录下 再在web.xml加上     <filter>         <filter-name>Set Character Encoding</filter-name>         <filter-class>filters.SetCharacterEncodingFilter</filter-class>         <init-param>             <param-name>encoding</param-name>             <param-value>gb2312</param-value>         </init-param>     </filter> 以后就不用在jsp中转码了!至于jsp显示中文的方法是在你的jsp页面的顶端加上如下语句: <%@ page contentType="text/html;charset=gb2312" %> 和 <META http-equiv="Content-Type" content="text/html;charset=gb2312"> 
      

  4.   

    楼上的,我找不到这个类文件,能不能将你的SetCharacterEncodingFilter.class发到