Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

images in WEB-INF  RSS feed

 
Danny Rivet
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which dispatches to a jsp view that is in WEB-INF/folder1 (I put it in there because I dont want anyone to have direct access only via a servlet). My jsp will need to access a image, which is also in the WEB-INF/folder1 using a html img tag. What will the path to the image be?

Thanks

Danny
 
Dave Tolls
Ranch Hand
Posts: 2504
27
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not the JSP that needs access, it is the clients browser.

With that in mind you either have to move the image outside of WEB-INF so it is visible via a URL, or you need to provide a servlet that will stream an image based on some id or file name.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's correct to have the JSPs hidden from direct access, but as Dave pointed out, images, scripts, style sheets and other secondary resources cannot be hidden as the browser needs access to them.

Why do you have the images in WEB-INF in the first place?
 
Danny Rivet
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I don't need to hide the image
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!