get请求的接口从页面到controller类出现了乱码。tomcat
参数乱码:编码
String param = "...";server
使用new String(param.getBytes("iso-8859-1"), "utf-8"); 强制将此字符串转换成utf-8编码 ,能够转换成正确的中文。xml
猜想多是网页使用的iso-8859-1,到后台没有进行转码,若是每一个参数都手动转码,岂不是很麻烦,因此继续百度。。。。。找到了解决方案。接口
在tomcat中的server.xml中设置编码. 加一个URIEncoding就好了utf-8
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>字符串