採用Tomcat服務器,如果是其它的,可以參照說明修改Get中編碼格式
1. 瀏覽器向服務器提交中文參數數據
POST: request.setCharacterEncoding("utf-8");
GET: Server.xml文件中: <Connector URIEncoding="utf-8"/>[tomcat中]
2. 服務器向瀏覽返回着實送中文的數據
response.setContentType("text/html;charset=utf-8");
相當於:
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Type", "text/html;charset=utf-8");
Tomcat中配置
D:\apache\apache-tomcat-6.0.37\conf\server中的
<Connector connectionTimeout="20000" port="8989" protocol="HTTP/1.1" redirectPort="8443"/>裏面加入URIEncoding="utf-8"