at the begining of the jsp, you should have "<%@ page contentType="text/html;charset=big5"%>" or "<%@ page contentType="text/html;charset=GB2312"%>" there,and ensure there is no code before this line.

解决方案 »

  1.   

    new String(yourString.getBytes("ISO8859_1"),"gb2312");
      

  2.   

    以上的我都做过了。
        byte[] tmpbyte;
        name11 = request.getParameter("name11");
        name11 = name11.trim();    tmpbyte = name11.getBytes("ISO8859_1");
        name11 = new String(tmpbyte);在最上面也加了
    <%@ page contentType="text/html;charset=gb2312" %>
    我直接把变量取值出来是对的,可是就是传参数的时候出错
      

  3.   

    传之前
    request.setCharacterEncoding("gb2312")
      

  4.   

    试过了,还是乱码。。
    >_<
      

  5.   

    servlet 中 
    err = URLEncoder.encode("管理员帐号或密码错误!");
                       response.sendRedirect("/cyvod/manage/login.jsp?err="+err);**********************************************************************************
    jsp中
     <%
    if(request.getParameter("err")!=null)
    {
    String err=URLDecoder.decode(new String(request.getParameter("err").getBytes("iso8859_1"),"gbk"));
    out.print(err);
    }
           
    %>这样好使我都是这么做的
      

  6.   

    对了
    你要引用
    import java.net.URLEncoder;这个 哦
      

  7.   

    <%!
    public String getStr(String str)
    {
    try
    {
    byte[] temp_t=str.getBytes("ISO8859-1");
    String temp=new String(temp_t);
    return temp;
    }
    catch(Exception e)
    {
    return "null";
    }
    }
    %>
      

  8.   

    你这个问题我碰过,我的解决方法是:<%
    //.....jsp代码
    %><script language="javascript"%>
      window.location="huowuleixing.jsp?par1=<%=par1%>&name11=<%=name11%>";
    </script><%
    //....jsp代码
    %>
    不信可以试试。
      

  9.   

    我试过morni的方法了,可以~~
    不过为什么呢?为什么JSP传中文参数不行,我不管是放到JSP还是servlet中,传出来的都是乱码
      

  10.   

    jsp编程的时候有乱码,但是使用JavaScript是用你的浏览器来转向,把事情交给浏览器了。
    你在页面中显示的是中文,但是使用response.sendRedirect的时候,它变了编码
    你用javascript直接把中文地址叫给浏览器,中间没有转换编码的问题
      

  11.   

    在用URL传值时,中文会被重新编码为UTF-8编码,所以最好不要用URL传值,在JSP里面好象有一个<jsp:forward...>的对象可以用,它可以跳转时带参数,只要在里面嵌入param语句就可以了。
      

  12.   

    sadenxu(潜心修炼) 的方法是能解决这个问题的,本人提醒一下,request.setCharacterEncoding("gb2312")
    "<%@ page contentType="text/html;charset=GB2312"%>
    以上二句看你的实际情况而加,在页面显示正常不等于数据库显示正常。