tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Flaherty <>
Subject Links in CSS vs JSPs
Date Sun, 18 Sep 2011 16:55:20 GMT

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.  
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/ 
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)

I’m just wondering if this make sense to someone with Tomcat  
experience. Is there a hard and fast rule here I’m missing. What’s  
best practice ?

Thanks in advance
View raw message