String id=new String(request.getParameter("id").trim().getBytes("ISO_8859_1"));

解决方案 »

  1.   

    一,我看到有的书上写的是:iso-8859-1,你试下
    二,在view.jsp页加request.setCharacterEncoding("gb2312");试下
      

  2.   

    用这个试试
    public static String convert(String str)
    {
    if (str == null)
    {
    return null;
    }
    int len = str.length();
    byte[] bt = new byte[len];
    for (int i = 0; i < len; i++)
    {
    bt[i] = (byte)str.charAt(i);
    }
    String retn = new String(bt);
    return retn;
    }
    ________________________
    www.elingke.com
      

  3.   

    在你生成的html文本中加上
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    试试
      

  4.   

    在doGet()方法中的第一行加:request.setCharacterEncoding("gb2312");
      

  5.   

    首先保证你页面上的charset设置的是gbk或gb2312
    然后不用转换编码试下。
    不行就在得值前加入request.setCharacterEncoding("gb2312");
      

  6.   

    在servlet中加response.setCharacter("gb2312")或者把gb2312改成gbk
    然后在页面中取值
    String id = new String((String)request.getParameter("id").trim().getBytes("gb2312"),"gbk");试试。一般都可以解决的。