One thing I've done in the past is to treat CSS files as JSPs and use
s:url tags or EL expressions (${contextRoot}/images/image.gif)...

Pointing your jsp servlet in tomcat to CSS files, IIRC, didn't work
right (I think I found the JSP servlet was actually looking at the
file and saying - "hey, this isn't a JSP, I'm just going to serve it
up w/o parsing/compiling). But, you can create a JSP and set the
content-type via JSP directive and put CSS content within.

-Wes

On Tue, Aug 4, 2009 at 12:38 PM, Andy Law<andy....@roslin.ed.ac.uk> wrote:
>
> I'm trying to specify a CSS style to be applied to a table header row that
> includes a reference to a background image (specifically as part of a table
> that uses JQuery/tablesorter). It is causing me pain.
>
> To clarify what may be a bit of a garbled question, my (final, effective)
> html needs to look something like this....
>
> <th class="myclass">Header</th>
>
> and my CSS file needs to look something like...
>
> th.myclass {
>    background-image: url('images/image.gif');
> }
>
>
> The problem is how to specify the url in the CSS file so that it works when
> the page is rendered as part of the web application.
>
>
> Of course, I don't know what context my web app will be deployed at, nor do
> I wish to hard-code it into the css file as that will then break if I try to
> deploy at a different context. I've been trawling through web pages all
> afternoon trying to find the answer but with no success so far.
>
> I have found reference to the FilterDispatcher serving static content along
> with some confusing documentation about what the struts.serve.static
> property actually does (starting from
> http://stackoverflow.com/questions/870440/how-does-struts-2-includes-javascript-files-in-a-jsp-from-their-struts-jar
> here ) but putting my static images in a subdirectory of the template
> directory (for want of a better place) still don't work.
>
> Can someone please point me in the right direction for getting this to work?
> Or point me at a work-around?
>
> Thanks in advance,
>
> Andy
> --
> View this message in context: 
> http://www.nabble.com/CSS-background-images%2C-struts2-tp24811929p24811929.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to