在b.jsp里面把<%@ page contentType="text/html; charset=gb2312" %>
去掉

解决方案 »

  1.   

    对某些版本的Tomcat,如4.1.29,request.setCharacterEncoding("GB2312")对GET方式提交的信息无效(POST方式可以),必须得用getBytes(...)转换,如果你不幸撞到了这种版本,方法两个,一个是用getBytes强制转换,再就是换一个Tomcat
      

  2.   

    在你任务的每个部分.比如jsp/servlet/db之中的GB2312 都保持一致!
    看看看ok嘛?
      

  3.   

    不是,这个不涉及servlet,只是在页面之间的数据传递
      

  4.   

    把<%@ page contentType="text/html; charset=gb2312" %>
    改为<%@ page contentType="text/html;charset=8859_1"%>
    试一下
    这句request.setCharacterEncoding("gb2312");也去掉可以肯定试charset的设置问题,从这里着手吧
      

  5.   

    String tempclass1 = new String(tempclass.getBytes("ISO8859-1"));
    out.print(tempclass1);
    把要显示的加上上面的东西。
      

  6.   

    这是我参考别人的,你可以参考一下:
    jsp2.jsp:
    <%@ page contentType="text/html; charset=GB2312" %>
    <%@ page import="java.io.UnsupportedEncodingException"%>
    <%@ page import="java.net.URLEncoder" %>
    <html>
    <head>
    <title>
    jsp2
    </title>
    </head>
    <body bgcolor="#ffffff">
    <%String name = "中文";
    String encodedName = null;
    try {
      encodedName = URLEncoder.encode(name, "UTF-8");
      System.out.println("encodedName charset:");
    } catch (UnsupportedEncodingException uex) {
      System.out.println("Got UnsupportedEncodingException : " + uex.toString());
    }
    %>
    <a href="test2.jsp?name=<%=encodedName%>"><%=name%></a>
    </body>
    </html>
    test2.jsp
    <%@ page contentType="text/html; charset=GBK" %>
    <%@ page import="java.io.UnsupportedEncodingException"%><html>
    <head>
    <title>
    test2
    </title>
    </head>
    <body bgcolor="#ffffff">
    <h1>
    <%String name = null;
    try {
      name = new String(request.getParameter("name").getBytes("ISO-8859-1"), "UTF-8");
      System.out.println("name="+name);
    } catch (UnsupportedEncodingException uex) {
      System.out.println("Got UnsupportedEncodingException : " + uex.toString());
    }%>
    </h1>
    </body>
    </html>
      

  7.   

    在b.jsp里面把<%@ page contentType="text/html; charset=gb2312" %>
    去掉