struts2中form提交中文乱码

架构说明:Spring+Struts2+Ibatis
现象:页面及struts.xml的配置均以设置为UTF-8,但是表单提交时还是乱码
解决:在web.xml中添加配置如下
<filter>
<filter-name>encodingFilter</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>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

你可能感兴趣的:(spring,jsp,Web,ibatis,struts)