Reputation: 687
I am using Jsf 2 with Hibernate Validator. It works fine, but I don't know how I can set the order of the generated errors.
For an example:
My Managed Bean
public class UserPresentation {
@NotNull(message = "EmailNullError")
@Email(message="EmailNotValidError")
String email;
@NotNull(message="passwordNullError")
String password;
//getter,setter...
}
In the frontend the passwordNullError appears before the emailNullerror in the generated ul-Tag. How can I change that?
Upvotes: 2
Views: 668
Reputation: 61578
You could bind the message labels to your inputs, using the for
attribute. The validation messages will appear right behind the according inputs.
<h:inputText value="#{myBean.email}" id="email" />
<h:message for="email" />
<h:inputSecret value="#{myBean.password}" id="password" />
<h:message for="password" />
Upvotes: 1