//forwardsimp03.jsp
<%@page contentType="text/html;charset=GBK"%>
<jsp:forward page="forwardsimp04.jsp">
<jsp:param name="ref1" value="Hello World!"/>
<jsp:param name="ref2" value="测试"/>
</jsp:forward>
//forwardsimp04.jsp
<%@page contentType="text/html;charset=GBK"%>
<h2>调转之后的页面!!!!!!!!</h2>
<h2><%=request.getParameter("ref1")%></h2>
<h2><%=request.getParameter("ref2")%></h2>

解决方案 »

  1.   

    你参数传中文不乱码就怪了
    String content = new String(request.getParameter("ref2").getBytes("ISO-8859-1"),"GBK");
    out.println(content);用这个转码
      

  2.   

    服你,说的这么白了还不知道怎么改......
    //forwardsimp04.jsp
    <%@page contentType="text/html;charset=GBK"%>
    <h2>调转之后的页面!!!!!!!!</h2>
    <%
    String content = new String(request.getParameter("ref2").getBytes("ISO-8859-1"),"GBK");
    %>

    <h2><%=request.getParameter("ref1")%></h2>
    <h2><%=content %></h2>
      

  3.   

    http 提交数据的方法有两种 post get   如果是 post 就在
    request.getParameter("属性名")前面加一个
     request.setCharacterEncoding("gbk");如果是get 方法提交  就像 5楼 说的那样。
      

  4.   

    [org.apache.jasper.JasperException: An exception occurred processing JSP page /myTest/forwardsimp03.jsp at line 31: <%@page contentType="text/html;charset=GBK"%>
    2: <h2>调转之后的页面!!!!!!!!</h2>
    3: <%String content = new String(request.getParameter("ref2").getBytes("ISO-8859-1"),"GBK");%>
    4: <h2><%=request.getParameter("ref1")%></h2>
    5: <h2><%=content %></h2>
    Quote=引用 5 楼 dreamslink2010 的回复:]引用 4 楼 niu91 的回复:具体怎么加到里面,这个我不会引用 3 楼 dreamslink2010 的回复:你参数传中文不乱码就怪了
    String content = new String(request.getParameter("ref2").getBytes("ISO-8859-1"),"GBK");
    out.println(content);用这个转码
    ……
    [/Quote]
      

  5.   

    request.getParameter("ref2")返回Object
    先强转再.getBytes("ISO-8859-1")
      

  6.   

    只要把charset改成Charset就可以正常显示了