The jsp page garbled in a daily article

Source: Internet
Author: User

The jsp page garbled in a daily article

 

Based on the causes of Chinese Garbled text, there are mainly the following solutions:

 

 

1. When the form data submitted using the Post method contains Chinese characters.

In this way, you can call the setCharacterEncoding ("") method of the request object to set the request decoding method to the UTF-8 before obtaining the request parameter value. Like this:

 

2. When the form data submitted using the GET method contains Chinese characters.

 

Because the data we submit is appended to the end of the URL as a query string and sent to the server, the setCharacterEncoding () method called on the server does not work for this part of data, after obtaining the request parameter value, encode and convert it. Like this:

 

3. Set the contentType attribute of the page command directly through the JSP page to specify the encoding format of the page content, as shown in the following code:

 

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.