刚好解决了这个问题你就赶上了:
package db;
import  sun.io.*;
  /**
    *
    */
    ///////////////////////////////////////////////////////////////////////////////////////
  //字符转化类,其中封装了从Ascii到中文  与  从中文到Ascii  的静态函数                                                          //                                                                                        //
  ////////////////////////////////////////////////////////////////////////////////////////
  public  final  class  ChinessChange    {
  
          /**  Creates  new  ChinessChange  */
  
                public  static  String  AsciiToChineseString(String  s)  {
                          char[]  orig  =  s.toCharArray();
                          byte[]  dest  =  new  byte[orig.length];
                          for  (int  i=0;i<  orig.length;i++)
                                  dest[i]  =  (byte)(orig[i]&  0xFF);
                          try  {
                                  ByteToCharConverter  toChar  =  ByteToCharConverter.getConverter("gb2312");
                                  return  new  String(toChar.convertAll(dest));
                          }
                          catch  (Exception  e)  {
                                  System.out.println(e);
                                  return  s;
                          }
                  }
  
          public  static  String  ChineseStringToAscii(String  s)  {
                  try  {
                          CharToByteConverter  toByte  =  CharToByteConverter.getConverter("gb2312");
                          byte[]  orig  =  toByte.convertAll(s.toCharArray());
                          char[]  dest  =  new  char[orig.length];
                          for  (int  i=0;i<  orig.length;i++)
                                  dest[i]  =  (char)(orig[i]  &    0xFF);
                          return  new  String(dest);
                          }
                  catch  (Exception  e)  {
                          System.out.println(e);
                          return  s;
                  }
          }
  
  }
将此函数做成一个javabean在jsp中调用即可!

解决方案 »

  1.   

    看看这个可能有启发:http://www.csdn.net/expert/topic/550/550063.xml?temp=.142666“mysql支持中文的,你不必非用ISO8859,要让mysql支持中文你需要: 
    1.  在mysql配置文件中配置default  charset:default-character-set  =  gbk 
    2.  在jdbc连接时声明使用gb2312或gbk://host:3306/dbname?user=username&password=pass&useUnicode=true&characterEncoding=GBK”
      

  2.   

    和 lsb(冰雪天)(▲▲) 的大同小异:package db;import java.util.*;
    import java.sql.*;
    import java.io.*;public class DbConnection{
        // 这里是连接数据库等方法
        ....
        // to gb2312
        public static String bytes2gb(String gb) {
            String s =null; 
            if(gb!=null) { 
                try{ 
                    s = new String(gb.getBytes("ISO8859_1"),"GB2312"); 
                }catch(Exception e) {
                    System.out.println(e.toString()); 
                    e.printStackTrace(); 
                } 
            } 
            return s; 
        } 
        // to bytes
        public static String gb2bytes(String bytes) {
            String s =null; 
            if(bytes!=null) { 
                try { 
                    s = new String(bytes.getBytes("GB2312"),"ISO8859_1"); 
                }catch(Exception e){ 
                    System.out.println(e.toString()); 
                    e.printStackTrace(); 
                } 
            } 
            return s; 
        } 
    }使用方法:凡是用到rs.getString()语句的改成:(从数据库读出文件)
    db.DbConnection.bytes2gb(rs.getString("title"));凡是request.getParameter()改成:(即将写入数据库的数据)
    db.DbConnection.gb2bytes(request.getParameter("sign"));基本就搞定了。
      

  3.   

    lsb的方法我试过了,不行。
    转化後的字符串还好,可一进库里,就都成3f(?)了。
    另外 to justin:对于数据库中已有的中文,用rs.getString()取出时,就已经变成3f了,任你再怎么编码又有什么用?
    宝宝猫的方法我正在试,请大家继续提供方案。
      

  4.   

    你没有试过吗?我可是在redhat linux7.0 ;redhat linux7.1; win2k下调试过的。
      

  5.   

    你可能还是不明白我说的意思,给你个图表:    汉字 --> gb2bytes() --> [database] --> bytes2gb() --> 显示
    另外每个jsp页面要添加
    <%@page contentType="text/html; charset=gb2312"%>
      

  6.   

    谢谢jimjxr(宝宝猫) 
    我终于解决了中文问题,不过characterEncoding=ISO8859-1
    再一次谢谢,可惜只能给100分。