应该做编码转换
type = new String(type.getBytes("iso-8859-1"),"gb2312");

解决方案 »

  1.   

    只在服务器端的servlet下作编码转换旧可以了吗?是不是这样写程序
    String type=request.getparameter("type");
    type=new String(type.getBytes("iso-8859-1"),"gb2312");
      

  2.   

    1、使用POST的方法。
    2、request.getCharacterEncoding('gb2312')
      

  3.   

    1、使用POST的方法。
    2、request.setCharacterEncoding('gb2312')
      

  4.   

    http://expert.csdn.net/Expert/topic/2231/2231845.xml?temp=.1760675这里面方法很多的!
      

  5.   

    ---------------------- 
    Java中文显示问题FAQ 
    ---------------------- 
    1.控制面板-区域设置-英文(或直接安装英文版OS) 
    2.JSP页面中加入一条语句: 
      <%@ page contentType="text/html;charset=gb2312" %> 
    3.编译servlet使用: 
      javac -encoding iso8859-1 myservlet.java 
      在jsp的zone配置文件中,修改编译参数为: 
      compiler = builtin-javac -encoding ISO8859-1 
    4.CLASSPATH中加入i18n.jar的路径 
    5.源程序中加入代码变换函数: 
      <%! 
    public String getStr(String str){ 
    try{ 
    String temp_p = str; 
    byte[] temp_t = temp_p.getBytes("ISO8859-1"); 
    String temp = new String(temp_t); 
    return temp; 

    catch(Exception e){} 
    return "null"; 

    %> 
    6.如果是直接赋值的中文字串,用<%@ page contentType="text/html;charset=gb2312" %> 
      就足够了。 
    7.如果使用request传过来的中文字串,用getStr(String)方法转换后使用。