java - Spring Validation Annotations Order -


I want to ask that it is possible to clearly set up the verification order in the spring. I mean, I have this command object:

  public class UserData {@NotBlank Private String newPassword; @NotBank Confirm Password for Private String; @ Email (applyIf = "email is not empty") @notbank private string email; @notbank private string first name = ""; Private string middleName = ""; @NotBlank Private String lastName = ""; // getters / setters}  

and I display my error message at the top of the page like this:

  & lt; Spring: hasBindErrors name = "$ {} UserData" & gt; & Lt; Ul class = "errors" & gt; & Lt; C: forEach item = "$ {errors.allErrors}" var = "error" & gt; & Lt; Li & gt; Spring: Message message = "$ {error}" /> & lt; / Li & gt; & Lt; / C: foreach & gt; & Lt; / Ul & gt; & Lt; / Spring: hasBindErrors & gt;  

The problem is how to display my error messages in the following order:

  * Fill in the last name * Enter password * Your email Fill out the address * Fill the password again. * select your gender. * Fill in your first name  

This is not random, because this order is protected every time. It's not the alphabet, or any other order ... I'm really stuck. Can anyone help?

SpringModule is a dead project, it is no longer supported. If you need JSR-303 verification support in Spring, then I recommend using contextual implementation, and

After saying this, it will not fix your problem, but at least you will use up-to-the-day library, possibly making it easy to fix it.


Comments