Tomcat get/post提交中文乱码解决办法
2010-03-24 10:55
381 查看
首先是get方式提交乱码,修改tomcat的server.xml。在Connector节点添加URIEncoding="UTF-8"
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
然后是post方式提交乱码,tomcat中提供了一个filter用于修改request的编码。 文件目录是apache-tomcat-6.0.20webappsexamplesWEB-INFclassesfiltersSetCharacterEncodingFilter.java 在web.xml中配置过滤器指定编码
filter
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
然后是post方式提交乱码,tomcat中提供了一个filter用于修改request的编码。 文件目录是apache-tomcat-6.0.20webappsexamplesWEB-INFclassesfiltersSetCharacterEncodingFilter.java 在web.xml中配置过滤器指定编码
filter
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
相关文章推荐
- Tomcat get/post提交中文乱码解决办法
- 关于edoc程序tomcat post提交中文乱码解决办法
- get/post时中文乱码问题的解决办法
- Tomcat 不同版本下的get post 中文乱码解决办法
- myeclipse jsp post方式提交中文乱码解决办法
- get/post时中文乱码问题的解决办法
- Tomcat解决中文乱码之道(GET/POST)
- myeclipse jsp post方式提交中文乱码解决办法
- JQuery中Ajax的Post提交中文乱码、windows.location.href 中文汉字乱码和springmvc使用原生态HttpServletRequest接收参数中文乱码解决办法
- get/post时中文乱码问题的解决办法
- get/post时中文乱码问题的解决办法(转载)
- tomcat post提交和get提交产生乱码的解决办法
- get/post时中文乱码问题的解决办法
- myeclipse jsp post方式提交中文乱码解决办法
- 详解get请求和post请求参数中文乱码的解决办法
- 前台页面向后台提交中文出现乱码解决办法
- 关于jsp中文提交到后台乱码问题解决办法
- 采用DoGet方式提交中文,乱码产生原因分析及解决办法
- springmvc项目提交post表单参数乱码解决办法
- 解决表单Post方式提交的中文乱码问题