assuming your dir structure is like:

css
...main.css
images
....someimage.jpg

you can use this in your css: url(../images/someimagejpg)

and then this in your jsp:

<s:url var="mainCss" value="/css/main.css"/>
<link rel="stylesheet" href="${mainCss}"/>

musachy

On Tue, Aug 4, 2009 at 9:38 AM, 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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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

Reply via email to