struts2 jqury form 提交乱码解决

jquery.form插件提交表单时,是以utf-8提交的,
提交后action 接收出现乱码,经过处理用spring过滤器,

<!-- spring 编码过滤器,需放在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>
<!-- 当已经有字符集,是否用本过滤器的字符集替换 -->
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

还是乱码,用response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8")

newStr = new String(value.getBytes("GB2312"),"UTF-8");仍然乱码,

最后修改struts2的struts.i18n.encoding=utf-8时,乱码已解决、

happy!

你可能感兴趣的:(spring,jquery,Web,xml,struts)