IntelliJ Java IDE
The moose likes JSP and the fly likes Context Path Still Won't Display an Image Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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: 179

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: 179

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.
 
IntelliJ Java IDE
 
subject: Context Path Still Won't Display an Image
 
Threads others viewed
Security issue
scwcd study kit question???
Problem with secure connection and Form Based Authentication
Simple form-based authentication using JAAS
<user-data-constraint> working example
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture