myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aneesha Govil" <popcor...@gmail.com>
Subject Set actionlistener in java code?
Date Tue, 07 Nov 2006 07:49:21 GMT
Hi,

I need to associate an actionlistener with an htmlcommandbutton in java
code. I am using the following code snippet:

HtmlCommandButton addButton = new HtmlCommandButton();
addButton = new HtmlCommandButton();
MethodBinding mb = FacesContext.getCurrentInstance
().getApplication().createMethodBinding("#{filter.addFilterToSubset}", new
Class[0]);
addButton.setActionListener(mb);
addButton.setValue("Add");

The signature of addFilterToSubset method is as follows:

public void addFilterToSubset(ActionEvent event) {
     //some code here
    }

The problem is, on clicking the button, it tries to look for a method
addFilterToSubset() (no arguments). Shouldn't it be looking for one with
actionevent?

Please help. I don't know why something so simple isn't working.

Thanks a lot.
Regards,
Aneesha

Mime
View raw message