8 Replies Latest reply on Mar 25, 2008 10:36 PM by Tim Goodchild

    Accessing Seam components from a custom JSF Validator?

    Tim Goodchild Newbie

      I have a custom JSF validator (which does have @Name) from which I want to access a seam component (also a stateless session bean), which itself uses a seam injected PersistenceContext.

      public class UsernameValidator implements Validator
          AccountDao accountDao;
          public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
              // validation logic

      However the accountDao reference is null when the validator is executed.  I'm assuming this is because the validator is invoked as a POJO by the JSF lifecycle and seam is not involved. So how can I access Seam components and take advantage of a seam injected persistence context?

      Any help much appreciated.