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 pictures displayed, For example, in the E-disk Uploadphotos folder, but when using absolute path display, 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 picture on the server cannot be displayed on the client with an absolute path, because the absolute path 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 post-upload directory is d:/upload
Add a line to the Server.xml:
<context path= "/news/upload" docbase= "D:/upload"/>
Later, you can use Http://localhost:8080/news/upload/xxx.doc to access the

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 that when I started Tomcat it was started in eclipse, and the previous change Server.xml was modified in Tomcat's directory, which was aimed at Tomcat In the bin directory, the role of Tomcat when booting through Startup.bat

I'm now a Tomcat launcher in eclipse, so the changes don't work, so I went to eclipse and tried to find Tomcat's server.xml,

Sure enough, in the workspace server directory to find the Tomcat configuration file, and then modify the server.xml here can be, if I say the path is not found, I try to find other places, anyway.

As for the server.xml of the way to modify the same as the previous said, if you do not understand the online tutorial, a search a large, but it is the same-made to modify the Server.xml, did not say clearly modify the Tomcat directory or eclipse.

jason0539

Weibo:http://weibo.com/2553717707

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

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.