Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Context Path Still Won't Display an Image

 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic