rich:messages is an extension for a standard h:messages component. In addition to what the standard component provides, rich:messages:
The message markers is defined with facets. There are several facets names available to design the marker for different kind of messages severities. The following example shows how the markers might be used to mark the "passed" and "failed" form fields. Fill the form and click the "Ajax Validate" button to see the entered data passing the defined validation rules.
<!DOCTYPE html> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <rich:panel style="width:400px"> <f:facet name="header"> <h:outputText value="Validation Form" /> </f:facet> <h:form id="form"> <rich:messages ajaxRendered="true" /> <h:panelGrid columns="2"> <h:outputText value="Name:" /> <h:inputText label="Name" id="name" required="true" value="#{userBean.name}"> <f:validateLength minimum="3" /> </h:inputText> <h:outputText value="Job:" /> <h:inputText label="Job" id="job" required="true" value="#{userBean.job}"> <f:validateLength minimum="3" maximum="50" /> </h:inputText> <h:outputText value="Address:" /> <h:inputText label="Address" id="address" required="true" value="#{userBean.address}"> <f:validateLength minimum="10" /> </h:inputText> <h:outputText value="Zip:" /> <h:inputText label="Zip" id="zip" required="true" value="#{userBean.zip}"> <f:validateLength minimum="4" maximum="9" /> </h:inputText> <f:facet name="footer"> <a4j:commandButton value="Ajax Validate" /> </f:facet> </h:panelGrid> </h:form> </rich:panel> </ui:composition>