You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by hicham abassi <ha...@gmail.com> on 2005/08/09 10:57:58 UTC
generic component binding
Hello,
Is it possible to bind any jsf component to a generic jsf tag.
<h:baseJSFTag binding="#{managedBean.anyJsfComponent}"/>
I want to know if we can generate dynamically bind all jsf components
on a jsp page without specifiing the jsf tag type.
Thanks
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.
>
>
Re: generic component binding
Posted by NDBurn <An...@hotmail.com>.
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>.
Specifically, you'll probably want to bind to a UIComponent variable.
binding="#{page.locationComponent}"
private transient UIComponent locationComponent;
public UIComponent getLocationComponent()
{
return this.locationComponent;
}
public void setLocationComponent(UIComponent locationComponent)
{
this.locationComponent = locationComponent;
}
I do this all the time to associate FacesMessages to a specific component.
facesContext.addMessage(locationComponent.getClientId(facesContext),
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"message summary", "message detail")
);
-Mike
On 8/9/05, Sean Schofield <se...@gmail.com> wrote:
> You have to bind to a method. You can do something like :
>
> <h:inputText value="#{fooBean.someMethod} binding="#{barBean.someOtherMethod}"/>
>
> or use the same bean for both the binding and value attributes like:
>
> <h:inputText value="#{fooBean.someMethod} binding="#{fooBean.setTextComp}"/>
>
> HTH,
>
> sean
>
> On 8/9/05, hicham abassi <ha...@gmail.com> wrote:
> > I want to fix my request by :
> > jsf development without jsp :
> > * feedbacks
> > * adv/draw
> > the myfaces' way to do it
> >
> > Thanks
> >
> > 2005/8/9, hicham abassi <ha...@gmail.com>:
> > > Hello,
> > >
> > > Is it possible to bind any jsf component to a generic jsf tag.
> > >
> > > <h:baseJSFTag binding="#{managedBean.anyJsfComponent}"/>
> > >
> > > I want to know if we can generate dynamically bind all jsf components
> > > on a jsp page without specifiing the jsf tag type.
> > >
> > > Thanks
> > >
> >
> >
> > --
> >
> > hicham ABASSI
> > habassi@gmail.com
> >
>
Re: generic component binding
Posted by Sean Schofield <se...@gmail.com>.
You have to bind to a method. You can do something like :
<h:inputText value="#{fooBean.someMethod} binding="#{barBean.someOtherMethod}"/>
or use the same bean for both the binding and value attributes like:
<h:inputText value="#{fooBean.someMethod} binding="#{fooBean.setTextComp}"/>
HTH,
sean
On 8/9/05, hicham abassi <ha...@gmail.com> wrote:
> I want to fix my request by :
> jsf development without jsp :
> * feedbacks
> * adv/draw
> the myfaces' way to do it
>
> Thanks
>
> 2005/8/9, hicham abassi <ha...@gmail.com>:
> > Hello,
> >
> > Is it possible to bind any jsf component to a generic jsf tag.
> >
> > <h:baseJSFTag binding="#{managedBean.anyJsfComponent}"/>
> >
> > I want to know if we can generate dynamically bind all jsf components
> > on a jsp page without specifiing the jsf tag type.
> >
> > Thanks
> >
>
>
> --
>
> hicham ABASSI
> habassi@gmail.com
>
Re: generic component binding
Posted by hicham abassi <ha...@gmail.com>.
I want to fix my request by :
jsf development without jsp :
* feedbacks
* adv/draw
the myfaces' way to do it
Thanks
2005/8/9, hicham abassi <ha...@gmail.com>:
> Hello,
>
> Is it possible to bind any jsf component to a generic jsf tag.
>
> <h:baseJSFTag binding="#{managedBean.anyJsfComponent}"/>
>
> I want to know if we can generate dynamically bind all jsf components
> on a jsp page without specifiing the jsf tag type.
>
> Thanks
>
--
hicham ABASSI
habassi@gmail.com