struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: Dynamic include of a CSS stylesheet
Date Tue, 02 Sep 2008 13:28:23 GMT
Alexander Baetz wrote:
> Hi,
>
> ok, this is not really a struts question but we came to it while 
> creating tiles pages. it might be that i'm thinking wrong.
>
> scenario:
> in writing a tiles template. there i want to include an external 
> stylesheet x. when an action (domain/namespace/myAction.action) is 
> executed the result creates a page that uses this stylesheet.
> now the problem: i want to avoid to include the stylesheet with the 
> full path, including the domain. i would rather like to use the 
> relative path. But how can i do that?
>
> Correct me if i'm wrong, but the relative path differs, depending on 
> the url of the action. how can i create a link to the stylesheet that 
> works for all actions?
>

I often use:

<link type="text/css" rel="stylesheet" href="/css/main.css">
<link type="text/css" rel="stylesheet" 
href="${pageContext.request.contextPath}/css/main.css">
<link type="text/css" rel="stylesheet" href="${initParam.css}/main.css">

where ${initParam.css} refers to an init param in web.xml (useful if it 
needs to change with the deployment, such as a version number)



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


Mime
View raw message