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 ~~