To prevent garbled problems in the front-end incoming Chinese data, use the encoding filter provided by spring to unify the encoding.
To use the encoding filter, simply add the following code to the Web. xml:
<filter> <filter-name>CharacterEncodingFilter</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> </filter> <filter-mapping> <filter-name> characterencodingfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
The other is bound to be configured with the Viewresolver view parser, simplifying the view path defined in the method.
To use the view resolver, simply add the following code to the Springmvc-config.xml:
<!--definition View Resolver-- <bean id= "Viewresolver" class= " Org.springframework.web.servlet.view.InternalResourceViewResolver > <!--setting prefix-- <property Name= "prefix" value= "/web-inf/jsp/" ></property> <!--settings suffix-- <property name= "suffix" Value= ". jsp" ></property> </bean>
Web. Xml Configure encoding filter to solve Chinese garbled problem