myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Korherr <jakob.korh...@gmail.com>
Subject Re: ui:param value accessible in backing bean?
Date Wed, 21 Jul 2010 10:15:35 GMT
Hi Michael,

"I migrated my app from jsp/tiles to xhtml/facelets successfully in the last
2-3 days."

That's great :)

Hm, yes. Unfortunately I digged deeper into it and found out that <c:set> is
equal to <ui:param> on facelets-1.x, thus the suggested code only works for
JSF 2.0. I am sorry, but this means that you will have to find some other
tag which accomplishes this or you will have to write your own one (which
should not be too hard, because you can take the code from MyFaces core 2.0
SetHandler --> org.apache.myfaces.view.facelets.tag.jstl.core.SetHandler and
just register it in your facelets taglib).

I hope this helps!

Regards,
Jakob

2010/7/21 Michael Heinen <mhn4dev@googlemail.com>

> Hi Jakob,
>
> I migrated my app from jsp/tiles to xhtml/facelets successfully in the last
> 2-3 days.
> But your hint is unfortunately not working for me.
>
> namespace in xhtml file for core tags is: xmlns:c="
> http://java.sun.com/jsp/jstl/core"
> Is this the right one or do I have to use xmlns:c="
> http://java.sun.com/jstl/core" (without jsp)?
>
> jstl-1.2.jar is in the lib folder of my webApp.
>
> <c:out does not print anything and the set value is also not accessible via
> EL in the getter of my bean.
>
> My current code:
> <html xmlns="http://www.w3.org/1999/xhtml"
>      xmlns:ui="http://java.sun.com/jsf/facelets"
>
>      xmlns:c="http://java.sun.com/jsp/jstl/core">
>
> <ui:composition template="templates/main.xhtml">
> <ui:param name="activeTab" value="wb"/>
>
> <c:set var="foo2" value="bla2" scope="request"/>
>
> <c:set target="#{requestScope}" property="foo" value="fooValue" />
>
> <ui:define name="navigation">
> <ui:include src="/facelets/parts/navigation.xhtml"></ui:include>
> </ui:define>
>
> I try to access foo and foo2 in navigation.xhtml and in a getter called
> from navigation.xhtml.
> Any Idea what's going wrong here ?
>
> Greetz,
> Michael
>
> Am 20.07.2010 23:20, schrieb Jakob Korherr:
>
>  Hi Michael,
>>
>> You can use<c:set>  from the JSTL to put the value into the request scope.
>> Then you can access it in the facelet and also later in the action method.
>>
>> Namespace: xmlns:c="http://java.sun.com/jsp/jstl/core"
>>
>> <c:set target="#{requestScope}" property="foo" value="fooValue" />
>>
>> Regards,
>> Jakob
>>
>> 2010/7/20 Leonardo Uribe<lu4242@gmail.com>
>>
>>
>>
>>> Hi
>>>
>>> I checked in deep some days ago ui:param, and it only define the
>>> expression
>>> when the view is build, but its context is not preserved on other phases.
>>> FaceletContext extends from ELContext and override its VariableMapper and
>>> FunctionMapper. So in practice, ui:param just add a variable on the
>>> variable
>>> mapper. but after ui:composition and ui:include ends its processing the
>>> variable is just discarded, because the whole VariableMapper wrapper
>>> created
>>> by this two tags is removed too.
>>>
>>> regards,
>>>
>>> Leonardo Uribe
>>>
>>> 2010/7/20 Michael Heinen<mhn4dev@googlemail.com>
>>>
>>>
>>>
>>>> Is it possible to access the value of a facelets ui:param tag in phase
>>>> render response in a backing bean?
>>>> I tried to resolve #{activeTab} in MyController.getOnlick() without
>>>> success.
>>>>
>>>> Sample:
>>>> 1) Template
>>>> <ui:composition template="templates/main.xhtml">
>>>> <ui:param name="activeTab" value="blabla"/>
>>>>
>>>> <ui:define name="navigation">
>>>> <ui:include src="/facelets/navigation.xhtml"></ui:include>
>>>> </ui:define>
>>>>
>>>>
>>>> 2) navigation.xhtml
>>>> ...
>>>> <t:commandLink onclick="#{MyController.onlick}"
>>>> ...
>>>>
>>>> I use myFaces 1.2.9 and facelets 1.1.15.
>>>>
>>>> Thanks,
>>>> Michael
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>>
>
>


-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message