参考: http://blog.youkuaiyun.com/lfsf802/article/details/7232834
GET提交方式:
第一种:是通过String类的getBytes方法进行编码转换,具体java代码是:
new String(request.getParameter(“name”).getBytes(“ISO-8859-1”),“客户端编码方式”)
客户端一般是通过用UTF-8或GBK, GB2312第二种:在服务器xml代码中改配置信息:
<Connector port="8080"protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443"URIEncoding="客户端编码"/>
POST提交方式:
request.setCharacterEncoding("UTF-8")设置编码,然后通过request.getParameter获得正确的数据。
response.setContentType("text/html;charset=GB2312");