Friday, June 25, 2010

JSF Validation Failed Notice

Here's how I show a notice on a JSF 2 page indicating that the JSF 2 postback failed due to validation errors. The following facelet snippet is rendered only when validation fails:
<h:outputtext 
   styleclass="errorMessage globalMessage" 
   value="Request *not* saved due to input errors" 
   rendered="#{facesContext.validationFailed}" />
The user then knows they should look through the page to correct the individually marked validation failures.