2.4. Presentation layer validation
When working with JSF and JBoss Seam, one can triggers the validation process at the presentation layer using Seam's JSF tags
<s:validate>
and <s:validateAll/>
, letting the constraints be expressed on the model, and the violations presented in the view
<h:form> <div> <h:messages/> </div> <s:validateAll> <div> Country: <h:inputText value="#{location.country}" required="true"/> </div> <div> Zip code: <h:inputText value="#{location.zip}" required="true"/> </div> <div> <h:commandButton/> </div> </s:validateAll> </h:form>
Going even further, and adding Ajax4JSF to the loop will bring client side validation with just a couple of additional JSF tags, again without validation definition duplication.
Check the JBoss Seam documentation for more information.