Implementing JSF validation with Seam
The Seam framework can simplify the process of implementing JSF validation. Firstly, Seam encourages us to follow the "DRY" principle ("Don't Repeat Yourself") popularized in The Pragmatic Programmer and advises us to try to avoid repetition when writing code. We can apply the DRY principle to JSF by declaring our validation constraints once and only once in our domain model. This can be accomplished using Seam's built-in support for the Hibernate Validator framework.
Secondly, Seam removes the need to declare additional validators in our user interface. Registering validators such as the<f:validateLongRange>
or<t:validateEmail>
with our components and declaring custom validators in faces-config.xml
becomes a thing of the past. As an additional benefit, Seam JSF validation includes enhancements such as highlighting invalid input fields that are not possible using basic JSF validation mechanisms.
In short, JSF validation is a significant improvement...