wood burning stoves 2.0*
The moose likes JSP and the fly likes Context Path Still Won't Display an Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Context Path Still Won Watch "Context Path Still Won New topic
Author

Context Path Still Won't Display an Image

Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

Hey all,

I don't do jsp pages often so I suspect my inexperience is the main cause of this one. I guess I get a little complacent in JSF land...

I'm trying to display a simple image in a jsp:



But all that displays is the alt text. The file is for sure in the /images folder, is spelled correctly and permissions on the file are read for everybody.

Seems like I'm missing something very simple.

I'm thinking maybe a web.xml problem, as if I try to enter the url of the image in my browser it redirects to the jsp page itself so the servlet is intercepting the request and matching it to a configured value. If so, I think this:



May be the issue due to the /* url pattern. I need to preserve this level of security, so does this mean I'll have to host the images in a separate webapp context?

Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

So 5 minutes after I posted that I realized the problem.



In the url-pattern I had been using a / only, instead of an actual string. Thus, the server was taking the separate URL request for the image and returning it as the same jsp page. By changing it to /welcome and adding /welcome to the request I got it to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Context Path Still Won't Display an Image