You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Mossakowski <dm...@Instinet.Com> on 2002/07/02 00:25:58 UTC

Re: Question about context paths and IMG URL's

I always do this in my JSP pages:

<%=request.getContextPath()%>/graphics/clear.gif

This way whatever you have your servlet mapped to it will work

d.

Chris Bailey wrote:
> But doesn't that just say the "images" directory _relative_ to the current
> page?  And, given that that page is generated by a servlet, I don't think
> that will work right will it?  Or does that actually say relative to the
> context?  I don't see how though, since this is just HTML and thus it means
> it's relative to the page (unless the servlet container/Tomcat does some
> magic to re-interpret the request?).
> 
> -----Original Message-----
> From: Lin, Zhongwu [mailto:Zhongwu_Lin@AFCC.com]
> Sent: Friday, June 28, 2002 12:09 PM
> To: 'Tomcat Users List'
> Subject: RE: Question about context paths and IMG URL's
> 
> 
> It should be
>       <img src="images/foo.gif">
> J
> -----Original Message-----
> From: Chris Bailey [mailto:chris@codeintensity.com]
> Sent: Friday, June 28, 2002 12:22 PM
> To: Tomcat Mailing List
> Subject: Question about context paths and IMG URL's
> 
> 
> I seem to have confused myself about the proper way to specify an image
> location in HTML that my servlet spits out.  If I have an "images" directory
> at the "root" of my webapp, is it safe to always do this:
> 
>    <img src="/images/foo.gif">
> 
> Or, how does the context "path" attribute play into this?  We always set our
> path to "" (our app is the only one running in the container).  But, I'm
> wondering about this if we wish to make it a bit more generic so that we
> could just give a customer a WAR file and let them set it up in their
> container as they wish.
> 
> ____
> Chris Bailey       mailto:chris@codeintensity.com
> Code Intensity       http://www.codeintensity.com
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 


-- 
David Mossakowski              dmoss@instinet.com
Instinet Corporation                 212.310.7275



*******************************************************************************
<<Disclaimer>>

This message is intended only for the use of the Addressee and 
may contain information that is PRIVILEGED and/or
CONFIDENTIAL or both.

This email is intended only for the personal and confidential use
of the recipient(s) named above.

If the reader of this email is not an intended recipient, you have
received this email in error and any review, dissemination,
distribution or copying is strictly prohibited.

If you have received this email in error, please notify the sender
immediately by return mail and permanently deleting the copy
you received.

Thank you.

*******************************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>