3 Replies Latest reply on Jun 16, 2008 7:58 AM by dan.j.allen

    Unclear ItemValidator example in reference (31.2)

    virgo47

      In section 31.2 of Seam reference (I've got 2.1 version) there is an example which is not very clear.


      @Name("itemValidator")
      @BypassInterceptors
      @Validator
      public class ItemValidator implements Validator {
      public void validate(FacesContext context, UIComponent cmp, Object value)
      throws ValidatorException {
      ItemController ItemController = (ItemController) Component.getInstance("itemController");
      return itemController.validate(value);
      }
      }
      



      First thing is that if you accept one import for Validator, the other usage of that type is broken - there are both Hibernate Validator annotation and JSF Validator interface used. Other thing is that there is return of something for void method.


      After I figured out Validator type mismatch (that wasn't that difficult after all) I really wasn't sure how this Validator should be used. How it says that the thing is invalid?