users@glassfish.java.net

Re: JSF 1.2_03 confusion....please help

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Thu, 15 Mar 2007 09:41:32 -0700

Derick+Potgieter wrote:
> Any one please help
>
> JSF 1.2_03 on glassfish 2 b19
>
> Why o why does this work
> <webuijsf:textField text="#{Hdr.contextPathValue}" id="contextPathValueID" visible="false" />
>
> But this does not
> <input id="contextPathValue2" name="test1" type="hidden" value="${Hdr.contextPathValue}"/>
> <input id="contextPathValue2" name="test2" type="hidden" value="#{Hdr.contextPathValue}"/>
>
> I was sure that the ${...} should work because of the unified expression language.
>
> Obviously I missed something...please help.
>
> The reason for doing this is to get the contextPath for my javascript variables...images and so forth.
>
> in jsf 1.1 i used this method
> <input type="text" value="${pageContext.request.contextPath}"/>
>
> but this doesnt seem to work anymore...is it a bug...or am i just loosing the plot
>
In 1.2 the JSF tags all expected deferred expressions which means using
#{...}. It worked in 1.1 since there
was no unified EL and everything was a string and evaluated after the fact.

I would recommend using the following expression to get the contextPath:
   #{facesContext.externalContext.requestContextPath}

> Thanks
> Derick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>