i'm trying to create a JSP page and display an image that is stored on the file server and contained within the war file...there are numerous "image" directories within the application
but when i do <img src="<% request.getContextPath(); %>/images/example.jpg"> from within the jsp page the image isn't displayed
the parameter request.getContextPath displays nothing when i check it...so how i can set the contextPath also?
Cheers,
Niall
mark walter
Greenhorn
Joined: Jun 20, 2008
Posts: 15
posted
0
Niall, If these images are contained within the war file then they are static images. So why do you need to build a dynamic url? <img src="<path>/images/some.jpg"/> should work just fine.
Originally posted by mark walter: Niall, If these images are contained within the war file then they are static images. So why do you need to build a dynamic url? <img src="<path>/images/some.jpg"/> should work just fine.
Becasue hard-coding the context path is an egregious violation of best practices.