tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: docBase application directory
Date Sun, 19 Aug 2007 17:09:31 GMT
I think your assumption regarding how tomcat uses docBase is in error.  
Path's in a HTML file are resolved by the BROWSER and as such there is 
no awareness of a webapp.  Your path "/img/pageheader_background.png 
would be a site relative path to either a webapp named img or in absense 
of that, a folder named img in the ROOT webapp.  If you want this to be 
correct, it should be "/web_gm/img/pageheader_background.png".  Since 
this is in a css file, you could also do a relative reference to your 
css file.  If the css is in a folder named css on the same level as the 
img folder, the reference would be ../img/pageheader_background.png

--David

jeusdi wrote:
> Hello forum, As you can see in
> http://i16.photobucket.com/albums/b45/jeusdi/doubt.png , from a CSS file I
> refer to /img/pageheader_background.png, but when I load the HTML page, the
> image isn't loaded. So, I believe tomcat doesn't found the image: CSS file
> is under css folder and the image is under img folder. I don't know why
> Tomcat doesn't found this image?
>
> META-INF/context.xml-->
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path="/web_gm" reloadable="true" docBase="web_gm"
> workDir="web_gm/work">
> </Context>
>
> I believed that docBase tell to tomcat that "/" of the web application
> deployed is "$docBase". So, if in my CSS file I write "/img/file.png"
> implies that tomcat searches file under $CATALINA_HOME/webapps/web_gm/img
> folder.
>
> Can you help me please? I want to refer to my resources using "/img/...", I
> don't want to use "../../img/...".
>
> Thanks for all in advanced.
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message