You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vikramjit Singh <vi...@gtllimited.com> on 2002/07/01 06:00:33 UTC

RE: Servlets & absolute URLs

images are static, and the browser has to know where they are placed to
display them properly, and the path should be absolute. ex:
webapps\contextname\images\imgname.jpg.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-----Original Message-----
From: Jason Young [mailto:jason.young@inet.com]
Sent: Friday, June 28, 2002 9:09 AM
To: tomcat-user@jakarta.apache.org
Subject: Servlets & absolute URLs


Background:
Running Tomcat 4.0.3 standalone
I have a context setup at "/context"
The context has two subdirectories, "jsp", and "images".

I have a JSP in /context/jsp that attempts to include an image from 
/context/images using the absolute URL "/images/<imgname>". However, my 
browser is unable to find the image using this kind of URL. It seems 
that the URL is always relative to the path that the JSP is run from, 
and it appears to really be trying to find the image at 
/context/jsp/images. If I change the URL to be "../images/<imgname>", my 
browser is able to find the image.

Is this correct behavior? I assumed URLs were always relative to the 
context, and not the servlets/jsps themselves.

Thanks!
Jason


--
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>