0

I'am using Struts2 project with tomcat server and I want to load pictures from my project I put the picture into webapp/WEB-INF/images/image.png and this in jsp <img src="WEB-INF/images/image.png"> but I've go this as en error in the browser

GET http://localhost:8080/crudreverse/WEB-INF/images/image.png 404

2 Answers2

1

Try this: <img src="images/image.png">

Bardales
  • 304
  • 1
  • 4
  • 14
1

Files under WEB-INF are, by design, not directly accessible to clients, unless you disable normal security precautions (please don't).

Images (in general) should not be stored in the app itself, but if they are, they need to not be under WEB-INF.

If they are under WEB-INF "on purpose" then you need an endpoint to stream those images, but there's little reason to do that.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302