提交form表单中文乱码
首先项目中已有如下配置:
页面:
<form action="${base}/ztzx/lianHeChengJie" accept-charset="UTF-8" onsubmit="document.charset='UTF-8'"> </form>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
web.xml
<filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
然后按照网上搜索提示添加如下:
但是依然乱码
而后在server.xml中添加URIEncoding="UTF-8"
<Connector connectionTimeout="20000" port="8050" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
解决!