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

