I checked a lot on the Internet, it is roughly known that Java in the network transmission of the default use of ISO-8859-1 encoding to pass the value, so the server needs to be transcoded in order to display normally. It's very depressing. It's impossible to write transcoding code every time you get the parameter value.
If you want to use spring filters for implementation, you don't know how to write the results.
Later, you can use the request on the Internet. setcharacterencoding ("gb2312") specifies the encoding of the parameter value when obtaining it. In the action and actionform pilot test, it is found that adding this code to the reset () method in actionform can solve this problem.
Later, it was said that <% request. setcharacterencoding ("gb2312"); %> was added to the JSP, and a little experiment was conducted. I did not know why.
I still want to use the filter method to implement it and write less code, which is currently under research. You copied the code section to get it done:
Web. xml
<Filter>
<Filter-Name> spring character encoding filter </filter-Name>
<Filter-class> org. springframework. Web. Filter. characterencodingfilter </filter-class>
<Init-param>
<Param-Name> encoding </param-Name>
<Param-value> gb2312 </param-value>
</Init-param>
</Filter>
<Filter-mapping>
<Filter-Name> spring character encoding filter </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>