1 Reply Latest reply on Jun 6, 2007 6:24 PM by hstang

    @Validator causing EntityHome.managed equal false

      Does anyone know why throwing a ValidatorException in annotated @Validator classes would cause EntityHome.managed false? Other validation errors would not cause the managed property to be false except for those matched by @Validator classes. In the code I provide below, after you enter "false" in the input text box, the button update button would disappear upon refresh because the managed property is set to false.


      ## sheep.xhtml

      <h:form>
       <f:facet name="afterInvalidField">
       <s:message/>
       </f:facet>
      
       <s:validateAll>
       <s:decorate>
       <h:inputText value="#{sheepHome.instance.name}"
       required="true"
       validator="testValidator"/>
       </s:decorate>
       </s:validateAll>
      
       <h:commandButton action="#{sheepHome.update}"
       value="Update"
       rendered="#{sheepHome.managed}"/>
      </h:form>
      

      ## sheep.page.xml
      <page>
      
       <begin-conversation join="true"/>
      
       <param name="id" value="#{sheepHome.id}" converterId="javax.faces.Long"/>
      
      </page>
      


      ## TestValidator.java
      @Name("testValidator")
      @Validator
      public class TestValidator extends EntityController
       implements javax.faces.validator.Validator, Serializable {
      
       public void validate(FacesContext facesContext, UIComponent uiComponent, Object object) throws ValidatorException {
       if ("false".equals((String) object)) throw new ValidatorException(new FacesMessage("Managed is false"));
       }
      }