can not display images under tomcat img, src absolute path will not be changed, Jiya

Category: Web Develop
2013-04-05 07:14:42

Sponsored Links
My jsp has the img tag, starting with relative path can not display images, I use an absolute path, but still no picture, I also established a html, the picture is still an absolute path, using IE can display pictures directly open, but html for this under tomcat can not display pictures, do not know where the problem lies

Sponsored Links

2013-04-05 07:17:17
you give on the following web-inf, of course, can not visit. . .
2013-04-05 07:29:20
Agree upstairs 2. .
I have also experienced problems like this, I was built under the project folder.
WebRoot establish an image folder, the picture on the inside
<img src="images/1.gif" />
Sometimes need such
<img src="../images/1.gif" />
2013-04-05 07:49:17
you make sure your directory structure and watch your images directory jsp directory and what is the relationship between the upward jump layer .. / layers .. / .. / himself so
2013-04-05 08:01:17
in your image path prepend <% = request.getContextPath ()%> on the line, do not get what the absolute path relative path, and that simple okay, complex non-halo can not
usage: <img src = " <% = request.getContextPath ()%> / images / q.gif "/> (If the images in the root directory of the words)
meaning of this statement is to read the project name, that is false The absolute path, he will not manage your project parties to the E drive or C drive, only to find he works
2013-04-05 08:16:55
forget to write code:
<img src = "file :/ / / E | / myWeb / images / q.gif "/>, <img src="file:///E:/myWeb/images/q.gif" /> and
<img src="E:/myWeb/images/q.gif" /> have used, will not
2013-04-05 08:32:48
<img src = "E :/ myWeb / images / q.gif" /> are used, will not

ha ha ha! Why do you have to use an absolute path it

my machine there is no E: drive, how could you get the picture?

you use this with

<img src="images/q.gif" />

this way, html file to the current directory, such as this directory
images / q.gif
2013-04-05 08:48:05
Oh no pictures below
recommendations into tomcat In his works img folder created under a special place pictures
2013-04-05 08:55:02
certainly not with the absolute path on the server to use the path ah brother.
2013-04-05 08:59:57
If you want to use relative paths
pictures and jsp used directly in the same directory name of the picture. suffix
If picture storage folder and jsp same directory, the folder / In its previous name
If you .. /
2013-04-05 09:06:38
the best thing to use relative paths.
build a folder images on webRoot below, and then with a good path to OK it.
2013-04-05 09:21:57
use relative paths, following the construction of the project folders to put the picture, and then press the 2nd floor of the practice can be a
2013-04-05 09:41:47
Oh, is not forgotten to put Picture ah, another with relative path ah, such as img folder put a picture can be written / img/0000.gif.
2013-04-05 10:01:08
<img src = "images / q.gif" / >

best relative path
2013-04-05 10:26:43
've said, I started is to use the relative path, because I did not do the test with an absolute path, the result was No, this is my original,
<img src = ".. / images / q.gif" border = "0" width = "100" height = "100" />, my results directory is
| __images
| __jsp
| __ This page
2013-04-05 10:57:13

agree ....
2013-04-05 11:28:14

on the project and under will not be placed under jsp
2013-04-05 11:53:25
put the project need to change the path below A. .
2013-04-06 12:28:56
they have solved, methods, and we share, images directory on the project, but also is a sibling of WEB-INF directory, because using a tomcat, access the root directory should be http:// localhost: 8080 /, so write directly in the page / images / *. jpg does not work, my virtual directory is myWeb, so you wrote "/ myWeb / images / *. jpg", there is a change to prevent future virtual directory , use request.getContextPath on it, so:
<img src = "<% = request.getContextPath ()%> / images / *. jpg" /> on it
2013-04-06 12:47:31
Oh been resolved, back to late :)
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.

Page 1 of 2    «»