struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Barefoot" <Joe.Baref...@motiva.com>
Subject RE: context relative image reference in a CSS file
Date Fri, 10 Jan 2003 22:03:26 GMT
No problem.  I think the Chinese call it "putting legs on the snake". :)  Happens to everybody
at some point or the other.

peace,
Joe


> -----Original Message-----
> From: Dan Payne [mailto:dpayne@sotx.org]
> Sent: Friday, January 10, 2003 12:42 PM
> To: Struts Users Mailing List
> Subject: RE: context relative image reference in a CSS file
> 
> 
> Duh. I forget what it's called when you develop an overly 
> complex solution
> to a *very* simple problem but that's exactly what I was 
> doing. Thanks Joe
> and Craig and all others who replied. I was thinking the path would be
> resolved from the file that contained the stylsheet link, not from the
> stylesheet file itself. I threw in the relative reference and 
> it's working
> like a charm.
> 
> Thanks again!
> 
> -Dan
> 
> -----Original Message-----
> From: Joe Barefoot [mailto:Joe.Barefoot@motiva.com]
> Sent: Thursday, January 09, 2003 7:33 PM
> To: Struts Users Mailing List
> Subject: RE: context relative image reference in a CSS file
> 
> 
> Okay, well I couldn't swear that "list-style-image:" works like
> "background:" in CSS sheets ('cause I haven't used it), but I 
> would assume
> that it does.  We use something like this all over our CSS:
> 
> background: url(../images/icon_confirm.gif);
> 
> The url reference above is intepreted by the *browser* relative to the
> location of the CSS file itself.  What file(s) the link to 
> your CSS file is
> found in is irrelevant for this interpretation, only the 
> location of the CSS
> file matters.
> 
> peace,
> Joe
> 
> > -----Original Message-----
> > From: Dan Payne [mailto:dpayne@sotx.org]
> > Sent: Thursday, January 09, 2003 5:10 PM
> > To: Struts Users Mailing List
> > Subject: RE: context relative image reference in a CSS file
> >
> >
> > Well, I can't use a relative reference as I've got over 500 JSPs in
> > many,many folders that are running off of 4 templates. It's
> > in the templates
> > that the CSS link is so a reference would only be valid from
> > the templates
> > folder (or another folder at the same level). The folder
> > structure is much
> > more complex than that. I wish it was that easy.
> >
> > I though of changing the .css file to .jsp and rewriting the
> > URL and I guess
> > I'll go with that option. Does noone recall the name of that
> > sourceforge
> > project? (I knew I should've saved that email...)
> >
> > -Dan
> >
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> > Sent: Thursday, January 09, 2003 6:04 PM
> > To: Struts Users Mailing List
> > Subject: RE: context relative image reference in a CSS file
> >
> >
> >
> >
> > On Thu, 9 Jan 2003, Joe Barefoot wrote:
> >
> > > Date: Thu, 9 Jan 2003 14:46:09 -0800
> > > From: Joe Barefoot <Joe.Barefoot@motiva.com>
> > > Reply-To: Struts Users Mailing List 
> <struts-user@jakarta.apache.org>
> > > To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> > > Subject: RE: context relative image reference in a CSS file
> > >
> > > The simplest solution is to use a relative path:
> > > ul {
> > >  list-style-image: url(../images/li.gif);
> > > }
> > >
> > > If you have your CSS file in folder 'css' (for instance),
> > with sibling
> > > folder 'images', this will work no matter what the app.
> > context name is,
> > > in Tomcat at least (I assume other web servers resolve 
> the same way
> > > though).
> > >
> >
> > Just a minor note ... servers don't resolve relative URIs --
> > clients do.
> >
> > However, as long as your browser obeys the CSS spec and
> > resolves relative
> > URIs against the absolute URL of the stylesheet (not the
> > source document),
> > then this technique should work fine.
> >
> > > Second option:  If you're using ant to deploy, you could
> > use tokens in
> > > your CSS files and have ant replace them during 
> copy/deploy using a
> > > filter task--you can conditionally use different filter values for
> > > replacement depending on a deploy target property or
> > something.  That's
> > > all I can think of.
> > >
> > > peace,
> > > Joe
> > >
> >
> > Craig
> >
> > > > -----Original Message-----
> > > > From: Justin Ashworth [mailto:justin-struts@ashworth.org]
> > > > Sent: Thursday, January 09, 2003 2:38 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: context relative image reference in a CSS file
> > > >
> > > >
> > > > Hi Dan,
> > > >
> > > > I just ran into this same issue today, and I hope that
> > > > somebody has a better
> > > > idea than what I ended up doing.  I changed the .css files to
> > > > .jsp and put
> > > > script tags around them and included them as JSPs.  This, of
> > > > course, gave me
> > > > access to taglibs which would let me prepend the context path
> > > > to the image.
> > > >
> > > > Your example would end up looking something like this:
> > > >
> > > > <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
> > > > <style type="text/css">
> > > > ul {
> > > > list-style-image: url(<html-el:rewrite page="/images/li.gif"/>);
> > > > }
> > > > </style>
> > > >
> > > > This is all I was able to figure out.  Does anybody have any
> > > > better ideas?
> > > >
> > > > Thanks,
> > > >
> > > > Justin
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Dan Payne" <dpayne@sotx.org>
> > > > To: <struts-user@jakarta.apache.org>
> > > > Sent: Thursday, January 09, 2003 5:31 PM
> > > > Subject: context relative image reference in a CSS file
> > > >
> > > >
> > > > > I recall seeing someone mention a project on sourceforge
> > > > that allowed one
> > > > to
> > > > > make context independent references to images from the
> > > > context root within
> > > > > CSS files. Anyone? Or perhaps another solution?
> > > > >
> > > > > I've got this entry in my stylesheet.css file:
> > > > >
> > > > > ul {
> > > > > list-style-image: url(/images/li.gif);
> > > > > }
> > > > >
> > > > > and it's causing one hell of a headache as the app is
> > deployed on
> > > > different
> > > > > contexts. Any ideas?
> > > > >
> > > > > thanks...Dan
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > <mailto:struts-user-help@jakarta.apache.org>
> > > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message