You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by NDBurn <An...@hotmail.com> on 2007/04/27 02:13:00 UTC

Re: generic component binding

when I bind several components to that method, is there a way to find out
which component triggered the method?




    public UIComponent getLocationComponent()
    public void setLocationComponent(UIComponent locationComponent)


-- 
View this message in context: http://www.nabble.com/generic-component-binding-tf209374.html#a10211367
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: generic component binding

Posted by Simon Kitching <si...@rhe.co.nz>.
If what you want is to know *why* the method was called, rather than 
specifically to get a reference to the UIComponent that triggered it 
then you can attach a t:updateActionListener to the component. The 
updateActionListener will execute before the action attribute executes.

   <h:commandButton action="#{bean.execute}">
     <t:updateActionListener property="#{bean.mode}" value="search"/>
   </h:commandButton>

Regards,

Simon

Mike Kienenberger wrote:
> If you use an ActionListener, you should be able to find the original
> component from the ActionEvent.
> 
> If you use an Action, no.
> 
> 
> On 4/26/07, NDBurn <An...@hotmail.com> wrote:
>>
>> when I bind several components to that method, is there a way to find out
>> which component triggered the method?
>>
>>
>>
>>
>>     public UIComponent getLocationComponent()
>>     public void setLocationComponent(UIComponent locationComponent)
>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/generic-component-binding-tf209374.html#a10211367
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>


Re: generic component binding

Posted by Mike Kienenberger <mk...@gmail.com>.
If you use an ActionListener, you should be able to find the original
component from the ActionEvent.

If you use an Action, no.


On 4/26/07, NDBurn <An...@hotmail.com> wrote:
>
> when I bind several components to that method, is there a way to find out
> which component triggered the method?
>
>
>
>
>     public UIComponent getLocationComponent()
>     public void setLocationComponent(UIComponent locationComponent)
>
>
> --
> View this message in context: http://www.nabble.com/generic-component-binding-tf209374.html#a10211367
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>