Jetty as a service JSP Chinese garbled, Tomcat as a service JSP Chinese normal

Source: Internet
Author: User

When using the Eclipse editor to develop JSP pages, the jetty startup service will be garbled in Chinese, but with Tomcat Chinese is normal.

At first, I thought it was me. Background code does not do encoding transcoding settings, after the online series of documents to check the adjustment, Chinese and garbled.

But then I found that when I directly access the JSP, do not go through the background code jump, the same phenomenon. This is my confirmation that it is the problem of my JSP page itself.

When I select the JSP page right-click on the property, look at the encoding type Iso8859-1, modified to UTF-8, again access to the JSP page, or garbled.

At this time I also modified the Eclipse window-"property in the Web JSP page settings and contranter JSP page encoding settings, changed to UTF-8, after testing or garbled."

My JSP page uses the include tag, I have a common header file page, the page has been written pageencoding= "UTF-8", as follows

<% @page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" UTF-8 "%>

But this garbled page of mine did not write this sentence. Finally I will each JSP page add this sentence, again test, Chinese normal, garbled disappeared.

Summarize:

The JSP page should be written in the first sentence to encode the settings, whether the page has no reference to other pages.

Of course, it may be that Tomcat is compatible with Chinese, so using Tomcat as a server JSP page does not require that each page be set to be encoded.

Jetty as a service JSP Chinese garbled, Tomcat as a service JSP Chinese normal

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.