(1)确定JSP页面头部是否有:<%@ page contentType="text/html; charset=GBK" %>
(2)用这个转码:
String param= new String(request.getParameter("param").getBytes("ISO-8859-1"), "GBK");
(3)添加filter字符过滤器
(4)如果是通过"a.jsp?param=中文"传递参数,则需要:
a.在传参数之前先把参数进行转码:java.net.URLEncoder.encode(param);
取值用java.net.URLDncoder.decode(param);再转回中文
b.在你的Tomcat目录-->conf目录-->server.xml里找出这段:
<Connector
port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" <!--在里边加上这个参数-->URIEncoding="gb2312"/>
from: http://www.yuanma.org/data/2006/0911/article_1503.htm