• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Context Path Still Won't Display an Image

 
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic