Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Display Image Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display Image Problem" Watch "Display Image Problem" New topic

Display Image Problem

Rajshekhar Anand

Joined: May 22, 2008
Posts: 14
Hi All ,

I have directory structure for my war file deployed in tomcat as below:


When I try to access the image
http://localhost:8080/ProjName/images/a1.gif -> I am able to see the image in browser

but when I try for
http://localhost:8080/ProjName/images/a2.gif -> This doesn't works.

Any Idea , what can be the issue.

When I use these images inside my index.jsp , I can't see the image a2.gif , but I can see a1.gif.


[ November 26, 2008: Message edited by: Gaurav Sinha ]
[ November 26, 2008: Message edited by: Gaurav Sinha ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
Are the permissions on that file set correctly so that it is world-readable?
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
(1) How big are the images?
(2) What server are you using? Can you enable trace log to see if the two images are actually sent?
(3) Is there any filter in the web.xml filtering on *.gif?

“Everything should be as simple as it is, but not simpler.” Albert Einstein
Rajshekhar Anand

Joined: May 22, 2008
Posts: 14
@Ulf Dittmer

world-readable permission mean ?
when I check properties for both files , they are same .
not checked for readonly permission.

@Duc Vo
images are in KB . 2.19KB
how to enable trace log . I will try to find , how to do it.
no there is no rule set for *.gif in web.xml

when I get the source of rendered jsp , from browser , save it as html . and then open it with browser , it works fine.
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
If your browser allows you to browse through the directory what do you see when you put this link? Do you see two .gif files?


If at all you see two files, then click on this a2.gif file.
Does it show the image you require? If yes, what url do you see in the address bar? Does it contain something like "%20". i just want to confirm if there are no spaces in the name.
[ November 27, 2008: Message edited by: Amol Nayak ]
Srikanth Nutigattu
Ranch Hand

Joined: Oct 30, 2007
Posts: 114
it may sound stupid! but check if you are using the correct "file Name" and also spelling mistakes in the URL's.
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Can you share with us what the exact problem was and what was done to solve that?
I agree. Here's the link:
subject: Display Image Problem
It's not a secret anymore!