It works now. Thanks.
Regards,
Aneesha
On 11/7/06, Volker Weber <[EMAIL PROTECTED]
> wrote:
Hi,
you need to declare the method arguments on createMethodBinding.
try:
createMethodBinding("#{filter.addFilterToSubset}", new Class[]
{ActionEvent.class});
You can take a look into the tag sources for information how to set
any tag attribute value into the UIComponent object.
Regards,
Volker
2006/11/7, Aneesha Govil <[EMAIL PROTECTED]>:
> 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
>
>

