Thanks for all the replies. I will stick with the relative paths for now as that seems simplest. I also agree about keeping the css files "clean". I would prefer not to use the JSP workaround for inserting the context path. I will look into the virtual hosts tho to see if it might be useful in the future.
Thanks again, Mike. -----Original Message----- From: Dhaval Patel [mailto:[EMAIL PROTECTED] Sent: 27 March 2007 17:33 To: Tomcat Users List Subject: Re: Paths in CSS files This is like one of those choice questions. As other mentioned, you can rename css file to jsp file and use custom jsp tags. Personally I would not use it because I use dreamweaver when I design page. So I need preview while working on css. Also I would like to make css code clean as well. Anyway that's just me. Also if there are separate developers and designers in the team, designers will find themselves comfortable with this approach as they can use their design tool nicely and would save their time. Developers will also get happy as they see less questions/bugs from designers. As you have pointed out, redirect might cause interference with other application. To avoid that, you might have to put style, images, script, etc. in separate folder called "assets" or something. This way your design elements or extra files will be only in "assets" folder and your main web application structure will remain unchanged. Now you might have two images folder, one in your webapp as well as one inside "assets". Those two folder serve different purpose. The one that is inside "assets" will only serve images that used by style and has only design meaning. Now the "images" folder on main webapp has images which have business meaning. For example, if you are selling some product, it has product images, etc. To me, it's just one decision which has to made. There are pros and cons of that but we we have to accept both. Regards, Dhaval ----- Original Message ---- From: Mike Quilleash <[EMAIL PROTECTED]> To: Tomcat Users List <users@tomcat.apache.org> Sent: Tuesday, March 27, 2007 10:32:57 AM Subject: RE: Paths in CSS files Hi Dhaval, I'd prefer to avoid relative addressing but I've read that the paths are relative to the css, not the html (which would cause problems) that is loading it so it may work ok. Using a redirect in web.xml is an interesting option, however if my app has to co-exist with another application on the same webserver, which may be using the root context, then I might end up annoying the other application too. Would this even work (I'm no expert) but would the app web.xml even be considered for URL requests that do not fall inside the web app context path? Thanks. Mike. -----Original Message----- From: Dhaval Patel [mailto:[EMAIL PROTECTED] Sent: 27 March 2007 14:35 To: Tomcat Users List Subject: Re: Paths in CSS files Hi Mike, Use relative address for images in your CSS. That's a quick way. The other way I can think of is to use redirect in web.xml of your webapp in such a way that all request to /image/* goes to context/image/* Hope it helps. Regards, D ----- Original Message ---- From: Mike Quilleash <[EMAIL PROTECTED]> To: Tomcat Users List <users@tomcat.apache.org> Sent: Tuesday, March 27, 2007 9:21:38 AM Subject: Paths in CSS files Hi all, I have a question about accessing resources from within CSS files, images mainly. Take the following CSS snippet. .bt { background:url(/image/box.png) no-repeat 100% 0; margin:0 0 0 18px; height:17px; } Particularly the url "/image/box.png". Potentially my Tomcat web application may be run with a context path so "/image/" becomes "/contextpath/image" and all the CSS breaks. Is there a way round this? Or should I be placing the urls somewhere else? Thanks. Mike. This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html ________________________________________________________________________ ____________ Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ________________________________________________________________________ ____________ Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]