"."/> ".">
#What should I do if the java picture cannot be displayed?
Solve the problem that images in some pages of the web page cannot be displayed when the javaweb project uses the Tomcat service.
I recently wrote a web project, but when I tested it in the browser, I found that the pictures on some pages could not be displayed.
Recommended tutorial: "java learning"
The reason is that some img tags or background-image in css request some pictures containing Chinese when loading the page. So this page will automatically send a request to the server to obtain resources, but this process will not be reflected in the address bar and is operated in the background. For example, I requested an index.html page but there was an tag in the page. The following can be observed through firedebug:
By default, tomcat uses ISO-8859-1 to process the request address, so the image cannot be displayed. The solution is as follows:
Find the server of the corresponding project in TomcatServers, then modify the server.xml configuration file and find in server.xml:
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
Change it to the following:
<Connector connectionTimeout="20000" URIEncoding="utf-8" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
So, the problem is solved.
The above is the detailed content of What should I do if the java image cannot be displayed?. For more information, please follow other related articles on the PHP Chinese website!