Modify Tomcat configuration in Eclipse to resolve global get commit garbled problem

Source: Internet
Author: User

In the project, if the page is submitted in the form of get, the Chinese will appear garbled.

We have two ways to solve the problem of garbled characters.

The first kind: Add get commit garbled solution in the program

New String (Username.getbytes ("iso-8859-1"),"UTF-8");

This way as long as there is a need, each method needs to add get garbled problem resolution code, the total seems to be quite troublesome.

Second: Directly modify the configuration of Tomcat, a one-time solution to the global get commit garbled problem.

Find the Tomcat configuration used for your project in 1.eclipse, open the Server.xml file

2. Locate the configuration line where port 8080 is located, and add uriencoding= "UTF-8". You can resolve the global get commit garbled.

Note: This approach solves the global get commit garbled. You will not need to resolve the get commit garbled in the project in the future.

Note: After the modification we can open the Tomcat installation directory. Go inside the Conf configuration folder

Open the Server.xml configuration file inside

It can be found that the eclipse changes are synced to Tomcat.

This also tells us that the get commit garbled problem in other projects is no longer solved.

If this time you in your program to add a similar to the following to resolve the Get Submit method garbled problem resolution code, but will be garbled.

New String (Username.getbytes ("iso-8859-1"),"UTF-8");

Modify Tomcat configuration in Eclipse to resolve global get commit garbled problem

Related Article

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.