JSP Web page does not display picture in browser _eclipse the virtual path of the JSP project in Tomcat under the environment

Source: Internet
Author: User

The problem is this, in the JSP Web page embedded in the local image, because it will be uploaded to the server image, so did not put in the project, but put all the pictures into a folder, and then plan to use the absolute path to display the picture displayed. For example, in the E-disk Uploadphotos folder. However, when the absolute path display is used. The code is as follows:

In Eclipse, the built-in browser can be displayed, but not to other browsers,

Later read this article

http://bbs.csdn.net/topics/320186157

Realize that the image on the server cannot be displayed on the client with an absolute path, as the absolute path is sent to the client browser. The absolute path of the client corresponds to the place and there is no picture. So to use the virtual path

Quote a passage to find

The virtual path is configured in Tomcat's Server.xml.
If your project is named news, the uploaded folder is D:/upload
Add a line to the Server.xml:
<context path= "/news/upload" docbase= "D:/upload"/>
You'll be able to use Http://localhost:8080/news/upload/xxx.doc to interview

This I tried many times, the principle is very clear no problem, but always do not work

After trying n times to check n times, I suddenly realized that my project was written under Eclipse and started Tomcat in Eclipse. Previous changes to Server.xml were made in the Tomcat folder, and the change was for the purpose of booting Tomcat through Startup.bat under the Tomcat Bin folder.

And I'm now the tomcat that started in eclipse. So the change didn't work, so I went to eclipse to try to find Tomcat's server.xml,

Sure enough, the Tomcat configuration file was found in the Workspace server folder. Then change the server.xml here to be able, assuming that the path I said did not find it. Just try to find somewhere else, anyway.

As for the server.xml changes in the same way as previously said, the assumption is not clear on the online tutorial, a search a large. Just make the change server.xml. Did not say clear changes in the Tomcat folder or in Eclipse.

jason0539

Weibo:http://weibo.com/2553717707

Blog:http://blog.csdn.net/jason0539(reprint please indicate the source)

JSP Web page does not display picture in browser _eclipse the virtual path of the JSP project in Tomcat under the environment

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.