views:

16

answers:

0

Greetings all i am using two validation annotations on a property in the bean

@NotEmpty(message = "{name.required}")
@Pattern(regex = "^([A-Za-z0-9]{2,}(\\-[a-zA-Z0-9])?)$", message = "{invalid.name}")
private String name;

if i left the name empty i got the two errors and i want only the first error message (if the first condition occurs show its error message then skip the second condition).