在a.jsp提交到b.jsp的时候用get方法,在b.jsp上可以正常显示,
但是,如果用post方法,在b.jsp上就会显示乱码。a.jsp如下:
<%@page contentType="text/html; charset=gbk" %>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
  <title>a.jsp</title>
</head>
<body>
这是a.jsp
<form name="form1" action="b.jsp" method="get">
<table>
  <tr>
    <td>user:<input type="text" name="user" value="中国"></td>
<td>pass:<input type="text" name="pass" value=""></td>
  </tr>
  <tr>
    <td><input type="submit" name="login" value="提交"></td>
  </tr>
</table>
</form>
</body>
</html>
-----------------------------------------------------------
b.jsp如下:
<%@page contentType="text/html; charset=gbk" %>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
  <title>b.jsp</title>
</head>
<body>
这是b.jsp</br>
user:<%= request.getParameter("user")%></br>
pass:<%= request.getParameter("pass")%>
</body>
</html>
--------------------------------------------------------------------
server.xml配置如下:
<Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000" 
               disableUploadTimeout="true" URIEncoding="gbk" />
---------------------------------------------------------------------

解决方案 »

  1.   

    加个<%
    request.setCharacterEncoding();
    %>
      

  2.   

    <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    再加个
    <% 
    request.setCharacterEncoding(); 
    %>
      

  3.   

    <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    再加个
    <% 
    request.setCharacterEncoding(); 
    %>
      

  4.   

    试下4楼的办法,另外再检查下server.xml
      

  5.   


    <%@ page language="java" import="java.util.*"pageEncoding="GBK"%>
      

  6.   

    在<head></head>之间加以下代码
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
      

  7.   

    http://blog.csdn.net/yehell/archive/2008/01/08/2030165.aspx,
    http://blog.csdn.net/yztommyhc/archive/2009/01/13/3765193.aspx,
    这2篇文章你看看,或许有你需要的东西。
    看看你的网页源文件是否是乱码。
      

  8.   

    lz看看这里的帖子http://topic.csdn.net/u/20080603/11/96b2c744-c925-4a3b-8a03-ce320b192684.html
    http://topic.csdn.net/u/20080603/11/9584916d-310a-44f3-83eb-e2bb3e2a5b35.html
      

  9.   

    如果用楼上的
    <% request.setCharacterEncoding();%> 还不行 就用
    <%= new String(request.getParameter("user").getBytes("iso-8859-1"),"GBK") %> 
      

  10.   

    我也没有具体调查,将所有可能的地方全部改为:UTF-8,就好了