The form is often submitted in a Web project, and occasionally the Chinese parameter is garbled.
Surf the internet for a bit, all kinds of solutions have.
Such as:
1. Set the head part in HTML
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
2, add in the form label:
<form method= "POST" action= "#" accept-charset= "UTF-8" >
Both of these methods have been tried, the problem is still not solved.
Then Baidu, find a way,
Add the following code to the Web. xml file:
<Filter> <Filter-name>Encodingfilter</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>Encodingfilter</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping>
Problem solving.
The text to remember!
SPRINGMVC Project submit post form parameter garbled solution