struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@dtgresults.com>
Subject Re: referencing javascript files from (action) jsp file
Date Fri, 15 Oct 2010 12:37:57 GMT
Hi Li,

JSTL and EL give you access to the implicit pageContext object.
>From there you can access attributes from request and session.


For example:
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>

And then use contextPath variable however you wish.

I'm not sure how this would translate into an OGNL expression.
But I'm sure others on this list do :)

/robert

----- Original Message ----- 
From: "Li Ying" <liying.cn.2010@gmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, October 15, 2010 4:12 AM
Subject: Re: referencing javascript files from (action) jsp file


> Hi Robert and Dave:
>
> I tried <c:url> in my application, and it works for almost all the case.
>
> But there is one exception:
>
> In my application, i customized the CSS files shiped with Struts JQuery 
> plugin
>
> and put them under path [{contextPath}/res/struts/].
>
> In JSP, i need add code likes:
>
> <sj:head jquerytheme="redmond" scriptPath="%{contextPath}/res/struts/" />
>
> to tell Struts JQuery plugin where to load js/css files.
>
> In this case, i think <c:url> can not help,
>
> because [contextPath] is a part of attribute value of another tag.
>
> I tried "%{#request.getContextPath()}", but it don't work for some
> reason i don't know.
>
> So i decide to remain my old solution(adding a property in my Action),
>
> so i can reference [contextPath] in Struts tags.
>
> Of cause, in simlpe URL case, <c:url> is a better choice.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Mime
View raw message