Tomcat乱码有以下两种解决方法:
1) 更改 D:\Tomcat\conf\server.xml,指定浏览器的编码格式为“简体中文”:(从页面通过Url传递中文到Action乱码处理)
找到 server.xml 中的
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding='GBK' />
2)更该 Java 程序
public class ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html; charset=GBK");
...
}
}