在web.xml配置以下节点,即可解决乱码
<!--过滤器处理乱码--> <filter> <filter-name>CharacterEncoding</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>CharacterEncoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>