天天看點

關于Json傳遞中文到struts2背景亂碼問題

設定三個地方的編碼方式:

1.tomcat中的server.xml中加上配置 URIEncoding="UTF-8":

 <Connector port="8080" protocol="HTTP/1.1" 

               connectionTimeout="20000" 

               redirectPort="8443" 

  URIEncoding="UTF-8"/>

2.struts.xml中配置:

<constant name="struts.i18n.encoding" value="UTF-8"/>  

3.項目工程的編碼方式設定成“UTF-8”