Another way we can implement custom validation is by adding validation methods to one or more of the application's named beans. The following Java class illustrates the use of validator methods for JSF validation:
package net.ensode.glassfishbook.jsfcustomval; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.component.html.HtmlInputText; import javax.faces.context.FacesContext; import javax.faces.validator.ValidatorException; import javax.inject.Named; import org.apache.commons.lang3.StringUtils; @Named @RequestScoped public class AlphaValidator { public void validateAlpha(FacesContext facesContext, UIComponent uiComponent, ...