2 Replies Latest reply on May 5, 2007 10:06 AM by Vladimir Ralev

    Seam validation problem with facelets source tag

    Chunyun Zhao Newbie

      Here is what I am trying to do:

      1. Create facelets source tag:

      In taglib:

       <tag>
       <tag-name>address</tag-name>
       <source>xhtml/address.xhtml</source>
       </tag>
      


      In address.xhtml:
      <ui:composition ...>
       ...
       <s:decorate>
       <h:inputText
       value="#{address.street}"
       id="street"
       </h:inputText>
       </s:decorate>
       ...
      </ui:composition>
      


      2. Now in my facelets that uses the tag:

      
       ...
       <s:validateAll>
       ...
       <v:address address="mybean.billingAddress"/>
       ...
       </s:valiateAll>
       ...
      
      


      The facelets loads fine with the address source tag, and when I enter invalid data in fields from address.xhtml, submit the form and I get the proper validation error messages, so far so good. But if I enter the valid data and submit form, I got the following stack trace:


      Caused by: java.lang.NullPointerException
       at org.jboss.seam.core.Expressions.getValidator(Expressions.java:198)
       at org.jboss.seam.core.Expressions.validate(Expressions.java:182)
       at org.jboss.seam.ui.ModelValidator.validate(ModelValidator.java:25)
       at javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:157)
       at javax.faces.component.UIInput.validateValue(UIInput.java:312)
       at javax.faces.component.UIInput.validate(UIInput.java:353)
       at javax.faces.component.UIInput.processValidators(UIInput.java:183)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIForm.processValidators(UIForm.java:70)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:146)
      
      


      If I change the address.xhtml to use #{mybean.billingAddress} directly like this:

      <ui:composition ...>
       ...
       <s:decorate>
       <h:inputText
       value="#{mybean.billingAddress.street}"
       id="street"
       </h:inputText>
       </s:decorate>
       ...
      </ui:composition>
      


      Then the problem goes away, although this works, but it defeats the purpose of reusing the tag in several other places.

      Any idea?

      Thanks.