jsp中:
    <%@ page contentType="text/html; charset=GBK"%>
    <%request.setCharacterEncoding("GBK");%>
     
    <HEAD><META http-equiv="Content-Type" content="text/html; charset=GBK"></HEAD>
servlet中:
    req.setCharacterEncoding("GBK");
如果还不好使,在存入数据库前用下面函数处理字符串
    public String switchChinese(String str) {
    try{
      String temp;
      byte[] temp_byte=str.getBytes("ISO8859-1");
      temp=new String(temp_byte,"GBK");
      return temp;
    }
    catch(Exception e){
      return null;
    }
  }