6 Replies Latest reply on Jul 21, 2007 11:32 PM by milli

    bug or limitation with seam/facelets ?

      Just wondering if it's possible to include a home object as a parameter into an included facelet source. When doing this, I'm getting a model validation error when submitting the form by persisting the home's instance:

      "model validation failed:null"

      Is this some bug or limitation?

      Here is an example:

      ## form.xhtml
      <ui:composition>
      <h:form>
       <h:inputText value="#{home.instance.property1}"/>
       <h:commandButton action="#{home.persist}" value="Persist"/>
      </h:form>
      </ui:composition>
      
      ## 1.xhtml
      <html>
      <ui:include src="form.xhtml">
       <ui:param name="form" value="#{helloHome1}"/>
      </ui:include>
      </html>
      
      ## 2.xhtml
      <html>
      <ui:include src="form.xhtml">
       <ui:param name="form" value="#{helloHome2}"/>
      </ui:include>
      </html>
      
      ## components.xml
      <fwk:entity-home name="helloHome1" entity-class="a.b.c.Hello"/>
      <fwk:entity-home name="helloHome2" entity-class="a.b.c.Hello"/>
      
      



        • 1. Re: bug or limitation with seam/facelets ?

          Correction on my example:

          <ui:param name="form" value="#{helloHome2}"/>
          
          
          should be
          
          
          <ui:param name="home" value="#{helloHome2}"/>
          
          
          
          
          


          • 2. Re: bug or limitation with seam/facelets ?
            rhardy5014

            I am getting a similar error (model validation failed: none) when trying to validate a field on a page use the hibernate validator.

            I am using:
            JBOSS 4.0.4GA
            Seam 1.2.1 GA
            Ajax4jsf 1.1.0


            The JSF snippet is:


            <s:decorate id="#{decorationID}">
             <h:inputText styleClass="#{invalid?'invalidField searchInput':'searchInput'}"
             value="#{searchInfo.fullText}"
             required="true">
             <s:validate/>
             <a4j:support event="onblur"
             reRender="#{decorationID}"
             eventsQueue="generalEventQueue"
             oncomplete="releaseAjax();"/>
             </h:inputText>
             </s:decorate>


            and my Seam bean property is validated as follows:

            @Length(max=20)
             private String fullText = null;


            The error occurs when ajax4jsf causes the inputText field to be validated.

            Any ideas what this error means?

            Thanks,
            Richard.

            • 3. Re: bug or limitation with seam/facelets ?
              pmuir

              Use your debugger to catch ValidatorException, and see what the stack trace is. Post the stack if you are stuck.

              • 4. Re: bug or limitation with seam/facelets ?
                rhardy5014

                I have found out some more information about my problem...

                The JSF element that is being validated by the validator, is located in a tag file from a tag library that I have written.
                The tag file is referring to: value="#{searchInfo.fullText}"

                "searchInfo" is actually a parameter that is passed to the tag file from the underlying page. It seems to be this reference to "searchInfo" that is causing an IllegalArgumentException within seam. (The exception seems to be caused because modelInstance evaluates to null within the validate method in org.jboss.seam.core.Expressions)

                If I refactor the code, and take all the elements out of the tagfile and put them into the main page, then the validation works correctly.

                Richard.

                • 5. Re: bug or limitation with seam/facelets ?
                  pmuir

                  Yes, this is known problem. With the new jboss-el we should finally be able to fix it. I can't find the issue for trackback, sorry.

                  • 6. Re: bug or limitation with seam/facelets ?
                    milli

                     

                    "petemuir" wrote:
                    Yes, this is known problem. With the new jboss-el we should finally be able to fix it. I can't find the issue for trackback, sorry.


                    I'm getting the same error when iterate a list using <c:foreach>. Is it a known problem as well? When I use <ui:repeat> it works though. The difference is when I use <c:foreach> I have to append index to all element ids.