tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: Links in CSS vs JSPs
Date Tue, 20 Sep 2011 13:09:40 GMT
2011/9/18 Patrick Flaherty <>
> Hi,
> We have just changed the way we deploy our webapp. We previously were putting our app
into the ROOT folder under webapps , not good I know.
> We now package the app as a war file called myapp.war and place it into the webapps
folder where it explodes into a folder called myapp. Everything
> works except for one thing. Our app has the option to let the user change the look &
feel of the web app using predefined skins which we store in a
> folder called templates inside the myapp folder. Inside the templates folder are
the folders that represent all the various skins (skin1, skin2 etc ..).
> These skin folders contain all the jsps, the css file and images that represent the content
of each skin.
> Here’s the problem which is easily remedied but I want to know why. Let me explain.
All the skins work except image references in the style sheet (css)
> cannot be found. Yet images referenced in the jsps are found ! The references to the
images begin with the url /templates/skin1/images/image1.png in both the
> css case and the jsp case. Now to fix the problem I change the url in the style sheet
by adding my app name in front (i.e. /myapp/templates/skin1/images/image1.png)
> and this fixes the problem.
> I have no problem with changing this and it’s even logical. I’m just trying to understand
why this only has presented a problem with links in the css and not the jsps.
> In firebug the reference to images already have my app name prepended to the images
automatically. (i.e. /myapp/templates/skin1/images/image2.png) YET the jsps’
> references only begin the url /templates/skin1/images/image1.png (no prepended app name)

1. Isn't it "templates/skin1/images/image1.png" in JSPs?
(Without leading "/", thus relative to the current page and not to the
root of the web server).

How do you print those links in JSPs? (Hard-coded, or you are using
some tag or API calls?)

2. How do you write the URLs in your css files?

Read the official CSS spec from W3C on how relative links in css files
are resolved. In CSS 2.1 it is in ch.4.3.4. Citing:
"For CSS style sheets, the base URI is that
of the style sheet, not that of the source document."

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message