which component invoke action-methode

is der a possibility to get the component which invoked an action-methode?
[81 byte] By [schaeflia] at [2007-11-27 0:09:33]
# 1
Use actionListener. Then you can use ActionEvent#getComponent() to retrieve the UICommand component which invoked the action method.
BalusCa at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
to bind an actionListener i useb_term.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.button_action}", new Class[0]));is that correct?because actionListener has a paramter...
schaeflia at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Use setActionListener() and define ActionEvent.class as parameter.
BalusCa at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

i don't know if I understand you...

do mean in that way:

b_term.setActionListener(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.button_actionListener}",javax.faces.event.ActionEvent.class));

because that doesn't work, ActionEvent.class should be a Class[]

schaeflia at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Yes .. Just put it in Class[] ..
BalusCa at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

ok, no i have:

Class[] param = new Class[1];

param[0]=ActionEvent.class;

b_term.setActionListener(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.button_actionListener}", param));

and

public void button_actionListener(ActionEvent event){

System.out.println(event.getComponent());

}

but it's never invoked

schaeflia at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
i am sorry...it is invoked, but it doesn't make a system.out.println
schaeflia at 2007-7-11 16:09:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...