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

Category: Web Develop
 
lw506212
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

wofente
2013-04-05 07:17:17
you give on the following web-inf, of course, can not visit. . .
libbly000
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
code
<img src="images/1.gif" />
Sometimes need such
<img src="../images/1.gif" />
ylmzhh88
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
kog1988
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
zhangxj103
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
heimathisme
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
test.html
images / q.gif
zhuiyiliu
2013-04-05 08:48:05
Oh no pictures below
recommendations into tomcat In his works img folder created under a special place pictures
baqiok
2013-04-05 08:55:02
certainly not with the absolute path on the server to use the path ah brother.
hudidi1985
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 .. /
a_09_18
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.
crisone
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
hlfwm
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.
dan123456789dan
2013-04-05 10:01:08
<img src = "images / q.gif" / >

best relative path
blcg55
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
WEB-INF
| __images
| __jsp
| __ This page
fuzhengjun1234
2013-04-05 10:57:13

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


on the project and under will not be placed under jsp
ice_mountain_jing
2013-04-05 11:53:25
put the project need to change the path below A. .
dongzhi801
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
stevenyu828
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    «»