req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8")
找到tomcat安装目录下conf的server.xml找到connector标签,添加URIEncoding=“UTF-8”
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
useBodyEncodingForURI="true"
URIEncoding="UTF-8"
redirectPort="8443" />