Reputation: 879
I would like to show specific error message. Here is my form.
<h:form id="userEntryForm">
<p:message for="email" styleClass="error-message"/>
<p:inputText value="#{UserActionBean.user.email}" required="true" id="email" />
</h:form>
When I use one parameter FacesMessage constructor as following,
public boolean isValid() {
if(...) {
FacesMessage facesMessage = new FacesMessage("Error : Email does not match.")
FacesContext.getCurrentInstance().addMessage("entryForm:newPassword", facesMessage);
}
}
error message shows properly with info style css. I want to show error style so that I used three parameter FacesMessage constructor,
FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : Email does not match.", "")
error sign appears but does not render error message as follow.
what is going wrong? thanks in advance.
Upvotes: 1
Views: 2958
Reputation: 30025
Both h:message
and p:message
show the detailed information per default. You can either put your message as third parameter of your FacesMessage
or you add showSummary="true"
and showDetail="false"
to your p:message
tag.
Upvotes: 4