You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stefano Panero <st...@gmail.com> on 2008/09/16 19:24:14 UTC

MyFaces el functions like 'rich:clientId'

Hi,

with Myfaces/Tomahawk how can I do something like richfaces
rich:clientId el function?

This function resolve the clientId of a componet passing the id,
respecting name containers:

For example:

<h:form id="workform" >
      <h:inputText id="intputText" />
      <h:outputText value="#{t:clientId('intputText')}">
 </h:form>

The outputText valu should be: "workform:inputText"

How can I implementig a function like this in a Facelets envinroment?

Thanks,
Stefano.

Re: MyFaces el functions like 'rich:clientId'

Posted by Simon Kitching <sk...@apache.org>.
Hi Stefano,

I'm not sure what Cagatay was suggesting here.

The "server side id" is ambiguous, ie it is perfectly allowed to have 
multiple components in the view with the same "server side id", as long 
as they are in different naming containers (forms, subviews, etc). So 
any function that looks up a component via its "server side id" also 
needs a reference to a component that is the "starting point" for the 
search, ie which is in the same "naming container" as the component you 
are trying to find.

A reference to the component on which the static method call is defined 
(eg the h:outputText component in the example below) would be a good 
choice as the "starting point" for a search. But AFAIK, the standard 
mechanism for defining static method calls (eg "t:clientId") doesn't 
have any way to ask "what is the component that triggered the call to 
me". So I have no idea at all how to implement this. Or how RichFaces 
could possibly implement this.

Stefano, you say you know of an API that "helps to find component in 
component tree respecting name container" in JSF1.2. Which API are you 
referring to?

And can you show an example of how the RichFaces code looks?

Regards,
Simon

Stefano Panero schrieb:
> Thanks,
>
> Is there an API the helps to find component in componet tree,
> respecting name container of course? I've found it in JSF 1.2, but not
> in 1.1. And we need the latter.
>
> Stefano.
>
>
>
> 2008/9/16 Cagatay Civici <ca...@gmail.com>:
>   
>> A solution would be that in your facelets method, you pass the server side
>> id of the component, then find it in the component tree, once you have the
>> component instance use UIComponent.getClientId(facescontext) to reach the
>> client id.
>>
>> On Tue, Sep 16, 2008 at 8:24 PM, Stefano Panero <st...@gmail.com>
>> wrote:
>>     
>>> Hi,
>>>
>>> with Myfaces/Tomahawk how can I do something like richfaces
>>> rich:clientId el function?
>>>
>>> This function resolve the clientId of a componet passing the id,
>>> respecting name containers:
>>>
>>> For example:
>>>
>>> <h:form id="workform" >
>>>      <h:inputText id="intputText" />
>>>      <h:outputText value="#{t:clientId('intputText')}">
>>>  </h:form>
>>>
>>> The outputText valu should be: "workform:inputText"
>>>
>>> How can I implementig a function like this in a Facelets envinroment?
>>>
>>> Thanks,
>>> Stefano.
>>>       
>>     
>
>   


Re: MyFaces el functions like 'rich:clientId'

Posted by Stefano Panero <st...@gmail.com>.
Thanks,

Is there an API the helps to find component in componet tree,
respecting name container of course? I've found it in JSF 1.2, but not
in 1.1. And we need the latter.

Stefano.



2008/9/16 Cagatay Civici <ca...@gmail.com>:
> A solution would be that in your facelets method, you pass the server side
> id of the component, then find it in the component tree, once you have the
> component instance use UIComponent.getClientId(facescontext) to reach the
> client id.
>
> On Tue, Sep 16, 2008 at 8:24 PM, Stefano Panero <st...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> with Myfaces/Tomahawk how can I do something like richfaces
>> rich:clientId el function?
>>
>> This function resolve the clientId of a componet passing the id,
>> respecting name containers:
>>
>> For example:
>>
>> <h:form id="workform" >
>>      <h:inputText id="intputText" />
>>      <h:outputText value="#{t:clientId('intputText')}">
>>  </h:form>
>>
>> The outputText valu should be: "workform:inputText"
>>
>> How can I implementig a function like this in a Facelets envinroment?
>>
>> Thanks,
>> Stefano.
>
>

Re: MyFaces el functions like 'rich:clientId'

Posted by Cagatay Civici <ca...@gmail.com>.
A solution would be that in your facelets method, you pass the server side
id of the component, then find it in the component tree, once you have the
component instance use UIComponent.getClientId(facescontext) to reach the
client id.

On Tue, Sep 16, 2008 at 8:24 PM, Stefano Panero <st...@gmail.com>wrote:

> Hi,
>
> with Myfaces/Tomahawk how can I do something like richfaces
> rich:clientId el function?
>
> This function resolve the clientId of a componet passing the id,
> respecting name containers:
>
> For example:
>
> <h:form id="workform" >
>      <h:inputText id="intputText" />
>      <h:outputText value="#{t:clientId('intputText')}">
>  </h:form>
>
> The outputText valu should be: "workform:inputText"
>
> How can I implementig a function like this in a Facelets envinroment?
>
> Thanks,
> Stefano.
>