I use the JSR303 Bean Validation to check the form input.
@NotBlank
@Size(min = 4, max = 30)
private String name;
@NotBlank
@Size(max = 100)
@Email
private
Have you considered to define two sequences. One for name and one for mail?
@GroupSequence({NameFirst.class, NameSecond.class})
interface AllName {
}
@GroupSequence({MailFirst.class, MailSecond.class, MailThird.class})
interface AllMail {
}
In this case you would call the validator like this:
validator.validate(myObject, AllName.class, AllMail.class)