<Constant name = "struts. i18n. encoding" value = "UTF-8"/>
Or set struts. properties (I have not tried it myself)
Struts. i18n. encoding = UTF-8
2. Add an encoding filter in web. xml
CharacterEncodingFilterorg. springframework. web. filter. CharacterEncodingFilterencodingUTF-8forceEncodingtrue
The above uses the built-in spring, or you can write it yourself. The core statement is request. setCharacterEncoding (this. encoding );
3. Set tomcat configuration
Both 1 and 2 can only set the encoding method for data submission in post mode. If the url has Chinese characters, garbled characters will occur. The solution is
The \ conf \ server File of tomcat
Add URIEncoding = "UTF-8 ". If you are using eclipse, restart eclipse, delete the server settings, and reset them. Because I didn't do this, the configuration file didn't take effect, and debugging lasted for half a day.
Source: http://blog.csdn.net/nature_fly088/article/details/7749589