网上找了一些方法:
方法一
在项目的web.xml中配置spring的Character Encoding Filter
<!-- Servlet Encoding Start -->
<filter>
<filter-name>Set Character Encoding</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>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Servlet Encoding End -->
目前使用该方法解决了中文乱码的问题。以后补上其他有关编码转换的一些方法:
参考:http://www.ylzx8.cn/qiyeruanjian/industry/1397810.html
http://luanxiyuan.iteye.com/blog/1849169