TOMCAT,SPRINGMVC Chinese garbled problem solving

Source: Internet
Author: User

GET protocol submitted in Chinese garbled:

The URL parameter, which is parsed at the tomcat level, requires setting the uriencoding parameter to Utf-8.

Locate the Server.xml file (typically in/etc/tomcat6/server.xml) and modify it to:

<ConnectorPort= "8080"Protocol= "http/1.1"ConnectionTimeout= "20000"Redirectport= "8443"uriencoding= "Utf-8"/><ConnectorPort= "8009"Protocol= "ajp/1.3"Redirectport= "8443"uriencoding= "Utf-8"/>

PS: If you use Apache to proxy through the AJP protocol, you also need to modify the configuration of AJP to UTF, see the example above.

POST protocol submitted in Chinese garbled:

If the data is post, the decoding work is handled by the SPRINGMVC code.

Find your project's Web. xml file, set the decoder parameters, can generally be:

<Filter>  <Filter-name>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>  </Filter><filter-mapping>  <Filter-name>Encoding</Filter-name>  <Url-pattern>/*</Url-pattern></filter-mapping>    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.