The image path contains the reason why Chinese characters cannot be normally displayed in jsp and the solution is:

Source: Internet
Author: User

The image path contains the reason why Chinese characters cannot be normally displayed in jsp and the solution is:

For example: , the image path is correct and can be opened normally on a separate html page. In jsp, the image is not displayed.

The reason is that URIEncoding is not configured in tomcat. Modification method:

Add URIEncoding = "UTF-8" to tomcat server. xml (the webpage encoding is UTF-8)
Copy codeThe Code is as follows:
<Connector port = "8080" URIEncoding = "UTF-8"/>


The jsp program written in myeclipse cannot display Chinese Images with relative paths. If you change the name of a Chinese image to a non-Chinese one, you can see why.

If you are a tomcat container, you can try to modify the container encoding.

In
<Connector port = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443" type = "regxph" text = "yourobjectname"/>
Join
URIEncoding = "UTF-8"

After modification
<Connector port = "8080" protocol = "HTTP/1.1"
ConnectionTimeout = "20000"
RedirectPort = "8443"
URIEncoding = "UTF-8"/>
Someone else sent it before. I'll help you transfer it.

In jsp, the img label path cannot contain Chinese characters. How can this problem be solved?

It can also be displayed in Chinese. You have changed the TOMCAT encoding ~~

Find the server. xml file change in the conf folder under the tomcat directory.
<Connector port = "8080" maxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"
EnableLookups = "false" redirectPort = "8443" acceptCount = "100"
ConnectionTimeout = "20000" disableUploadTimeout = "true" URIEncoding = 'utf-8'/>

Try this method ~~

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.