jsp页面get和post不同导致的乱码问题

一.post请求中默认使用iso-8859-1编码,并且可以进行修改

    request.setCharacterEncoding("utf-8");

二.get请求中默认也使用iso-8859-1编码,但是不能进行修改

方法一:修改tomcat下conf文件夹下,server.xml文件

  <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

方法二:

String  name=new String(request.getParameter("name").getBytes("iso8859-1"),"utf-8");

原文地址:https://www.cnblogs.com/wujianzhou/p/8391943.html