You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jeusdi <ca...@terra.es> on 2007/08/19 17:23:36 UTC

docBase application directory

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.
-- 
View this message in context: http://www.nabble.com/docBase-application-directory-tf4293850.html#a12223169
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: docBase application directory

Posted by jeusdi <ca...@terra.es>.
frodo@rohan:/usr/local/tomcat/webapps$ ls web_gm
conf  content  css  dtd  img  index.htm  js  META-INF  tlds  WEB-INF
frodo@rohan:/usr/local/tomcat/webapps$ ls web_gm/*
web_gm/index.htm

web_gm/conf:
log4j.properties

web_gm/content:
admin  current  errors

web_gm/css:
elements.css  estructura.css  gmsoft.css  NiftyCorners

web_gm/dtd:

web_gm/img:
background_posttittle.png  pageheader_background.png

web_gm/js:
NiftyCorners

web_gm/META-INF:
context.xml  MANIFEST.MF

web_gm/tlds:

web_gm/WEB-INF:
classes  lib  web.xml



Caldarale, Charles R wrote:
> 
>> From: jeusdi [mailto:cabrejcr@terra.es] 
>> Subject: docBase application directory
>> 
>> 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>
> 
> If you're using any reasonably recent version of Tomcat (you didn't
> bother to tell us), neither the path nor the docBase attribute are
> allowed in the <Context> element when it's in META-INF/context.xml.
> Remove those, and then let's work on your real problem.
> 
> What is the deployed directory structure of your webapp?  (Not
> interested in what shows up in your IDE - we need to look at reality.)
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/docBase-application-directory-tf4293850.html#a12223923
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: docBase application directory

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: jeusdi [mailto:cabrejcr@terra.es] 
> Subject: docBase application directory
> 
> 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>

If you're using any reasonably recent version of Tomcat (you didn't
bother to tell us), neither the path nor the docBase attribute are
allowed in the <Context> element when it's in META-INF/context.xml.
Remove those, and then let's work on your real problem.

What is the deployed directory structure of your webapp?  (Not
interested in what shows up in your IDE - we need to look at reality.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


Re: docBase application directory

Posted by David Smith <dn...@cornell.edu>.
Well.. not exactly.  Per the CSS spec 
(http://www.w3.org/TR/CSS21/syndata.html#value-def-uri), if the url is 
in a separate css file, it's relative to the css file, not the page.

--David

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jeusdi,
>
> jeusdi wrote:
>   
>> when I load the HTML page, the
>> image isn't loaded.
>>     
>
> You need to use paths in your CSS that are relative to the page being
> loaded -- it's kind of a pain. You need to put the context path into
> your CSS, and not as a variable, unless you are serving dynamic CSS files.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGyJw69CaO5/Lv0PARAgHVAJ46vMVrvyUjbSGaCbTXZJkdSfDcwwCfQqvK
> 4On1ONGoB4NrdVDBMHwCrSA=
> =u2OX
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>
>   


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


Re: docBase application directory

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeusdi,

jeusdi wrote:
> when I load the HTML page, the
> image isn't loaded.

You need to use paths in your CSS that are relative to the page being
loaded -- it's kind of a pain. You need to put the context path into
your CSS, and not as a variable, unless you are serving dynamic CSS files.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGyJw69CaO5/Lv0PARAgHVAJ46vMVrvyUjbSGaCbTXZJkdSfDcwwCfQqvK
4On1ONGoB4NrdVDBMHwCrSA=
=u2OX
-----END PGP SIGNATURE-----

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


Re: docBase application directory

Posted by David Smith <dn...@cornell.edu>.
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