V kódu:
FacesContext.getCurrentInstance().addMessage("fieldName", new FacesMessage("Error description"));
V šabloně:
<h:messages showOnlyGlobal="true" styleClass="errors" > <h:message for="fieldName" styleClass="errors">