On Mon, 19 Mar 2001, Tom Miller wrote:

> Hello all,
> 
> It seems that the html:img tag is able to find images in the context
> root, but not in subdirectories.
> When I specify an image with the html:img tag like this:
> <html:img src="green-ball.gif"/>
> the images appear.
> 
> But when I specify a subdirectory like this:
> <html:img src="WEB-INF/images/orange-ball.gif"/>
> the images are missing when the page renders, i.e. little red X symbol
> in the browser.
> 
> Here is a pared down JSP that illustrates the problem. It gives the same
> results whether I include the <html:base/> tag or not.
> 
> I'm using Struts 1.0b1 and Tomcat 3.2.1.
> 
> TIA for any help.
> 

The issue is that a servlet container is prohibited (in the spec) from
serving any file from the WEB-INF directory directly to a client.  This is
to prevent people from snooping sensitive information from your web.xml
file, or other config files you might have stored here.

If you want your image to be displayed, move it to some directory other
than WEB-INF.  Then, the URLs you use with the <html:img> tag will
correspond to what you would use with a regular HTML <img> tag.


> Tom

Craig McClanahan

Reply via email to