偶然遇到这个问题,utf-8编码格式用tomcat-6.0.18部署之后页面显示全是乱码。
解决方法:
配置tomcat的server.xml 在下面两个地方加:URIEncoding="UTF-8"
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000"redirectPort="8443"
URIEncoding="UTF-8" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
URIEncoding="UTF-8"/>
如果还是不行,可以在上面修改的基础上 从 tomcat 的自带项目 Examples是里的---\webapps\examples\WEB-INF\classes\filters
下找到 RequestDumperFilter.java 和 SetCharacterEncodingFilter.java,
加入到工程文件中去。
并把这个tomcat带的编码过滤器配置到web.xml里
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>xxx.xxx.xxx.SetCharacterEncodingFilter</filter-class>
<!--类路径-->
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
分享到:
相关推荐
tomcat-6.0.18
apache-tomcat-6.0.18安装包
tomcat-6.0.18 安装版 tomcat-6.0.18 安装版tomcat-6.0.18 安装版
基于LINUX的TOMCAT6 apache-tomcat-6.0.18-src.tar.gz
tomcat 6.0.18 最新 安装版
此为免安装软件,适合与eclipse等连用,免去了每次装系统的麻烦
Tomcat服务器apache-tomcat-6.0.18版
apache-tomcat-6.0.18.rar apache-tomcat-6.0.18.rar apache-tomcat-6.0.18.rar
apache-tomcat-6.0.18源码
tomcat-6.0.18 下载及安装,这是压缩版的,非安装版
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java ...
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with ... The ASF licenses this file to You under the Apache License, ...
apache-tomcat-6.0.18