Adding validation to a dynamically added UIInput

Hi All,

I'm trying to add validation to a dynamically added component but I kep getting the following error:

Caused by: java.lang.NoSuchMethodException: com.autobuild.web.backing.BuildBean.validateSnapshot()

at java.lang.Class.getMethod(Class.java:1581)

at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:118)

... 54 more

validateSnapshot() is defined in my backing bean as:

publicvoid validateSnapshot(FacesContext context,

UIComponent toValidate, Object value){

...

...

}

Now, my code to add the validator to the UIInput component is as follows:

...

MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{BuildBean.validateSnapshot}",null);

ipText2.setValidator(mb);

ipText2.setRequired(true);

panelPrevious.getChildren().add(ipText2);

...

I'm using JSF 1.1, not 1.2.

Does anyone know what the problem could be?

Thanks for any help,

Tom

[1251 byte] By [pr1ceya] at [2007-10-2 15:24:57]
# 1
From reading the JavaDoc on createMethodBinding() it looks like you need to add params.From the docs:params - Parameter signatures that must be compatible with those of the method to be invoked, or a zero-length array or null for a method that takes no
IamCowKinga at 2007-7-13 14:39:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...