jsf - JSF2.2 Annotated Validation not working -


i developing application using tomcat 7, jsf 2.2.6 (mojarra), hibernate validator 4.3.1 , have come across documented bug shown here: https://java.net/jira/browse/javaserverfaces-3183.

i have patched temporarily using fix given in answer on question: https://stackoverflow.com/a/21700488/1089995, until such time 2.2.7 released publicly.

however when attempt use annotations on fields, such @notnull, @size, etc, these ignored - there no relevant stack trace this, no error occurs, annotations ignored during validation phase.

page.xhtml

<input type="text" placeholder="e.g. joe bloggs" jsf:id="txtadminname" jsf:validator="#{bean.validateadminname}" jsf:value="#{bean.model.adminname}"/> 

model.java

//model bean bean validation, not applied field. @size(min = 3, max = 50, message = "please enter between 3 , 50 characters.") private string adminname; 

bean.java

//the model bean bean validation, shown below. private model model;  //jsf validator method, works fine public void validateadminname(facescontext context, uicomponent component, object convertedvalue) {   string adminname = convertedvalue.tostring();    if(adminname.matches(".*[0-9].*")) {     //not valid     throw new validatorexception(new facesmessage("please enter valid name."));   } } 

is isolated problem, or temporary fix not allow use of @annotations? ideas appreciated.

thanks.

edit: added sample working validator method source code, added info regarding lack of relevant stack trace.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -