We use the tomcat method and have found there are no issues:

What you do is that in either your tomcat web.xml or your app xml specify :

  <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.css</url-pattern>
  </servlet-mapping>


Which will treat the css files as jsps and parse any el expressions they
contain and in your css place the following at the top so the browser knows
its a CSS file.

/* <%@ page contentType="text/css;charset=UTF-8" %> */

And the your style cane be set as follows:

background-image: 
url('${pageContext.request.contextPath}/images/image.gif');


If it sounds complex its not.  The only drawback is that the CSS file won¹t
be cached by browsers and there may be a small performance hit.

Z.

> 
> Haroon Rafique wrote:
>> > 
>> > If your file structure is somewhat like:
>> > 
>> > styles/base.css
>> > images/image.gif
>> > 
>> > then you can simply change your background-image directive to say:
>> > background-image: url('../images/image.gif');
>> > 
>> > 
> 
> 
> and
> 
> 
> 
> Musachy Barroso wrote:
>> > 
>> > assuming your dir structure is like:
>> > 
>> > css
>> > ...main.css
>> > images
>> > ....someimage.jpg
>> > 
>> > you can use this in your css: url(../images/someimagejpg)
>> > 
>> > 
> 
> 
> Now I'm at my desk, I can see that this does indeed work. Thanks for the
> help guys.
> 
> Later,
> 
> Andy


Reply via email to