validation - CustomRequiredvalidator did not get triggered -


i confused because custom required validation did not triggered. got class creates htmltextinput element programmatically , adds validator. got custom validator class. console tells me validators got bound htmltextinput. anyway after hitting 'save' customrequiredvalidator did not called! using jsf 2.x. in advance.

// programmatically built htmlinput-element if (freetext.isrequired()) {     // validator-objekt     system.out.println("customrequiredvalidator bound.");     final customrequiredvalidator validator = (customrequiredvalidator) facescontext.getcurrentinstance().getapplication().createvalidator("customrequiredvalidator");     inputtext.addvalidator(validator); }  // customvalidator @facesvalidator("customrequiredvalidator") public class customrequiredvalidator implements validator {     @override     public void validate(facescontext context, uicomponent uicomponent, object value) throws validatorexception {         system.out.println("requiredvalidator.validate ..."); ...     } } 

validators invoked if conversion has succeed. if there's converter, either explicitly registered or implicitly used (e.g. having integer bean property trigger jsf builtin integerconverter) , threw converterexception, validator never triggered. should have noticed converter exception in of associated <h:message(s)> component or server logs.

if converter excluded being suspect, possible cause jsf configured not validate empty fields having following context parameter in webapp's web.xml:

<context-param>     <param-name>javax.faces.validate_empty_fields</param-name>     <param-value>false</param-value> </context-param> 

other that, well, running debugger, starting breakpoint @ uiinput#validate() method should give insights.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -