网上试过很多方式都未能解决。在这里我只分享一下我自己的解决方案:绝对行的通。
解决方案:
第一种方式:(适用于get/post两种提交方法)
修改所发布项目的服务器的server.xml文件中的<Connector />
元素修改前:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
元素修改后:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="utf-8" />
区别就是 添加了一个URLEncoding="UTF-8" 这个属性。
第二种方式:(只用于post提交方式)
在struts.xml中添加一个<constant />常量
<constant name="struts.i18n.encoding" value="UTF-8"/>