3 Replies Latest reply on Jun 23, 2006 11:29 AM by cptnkirk

    Seam + Facelets: use of JSTL and if tests

    PÃ¥l Oliver Kristiansen Newbie

      Hello !

      I've posted this to the Facelets list aswell but if anyone in here have any ideas to help me solve this problem, I can tell you that my weekend would look quite different ;)

      I have a seam component called "node" with a method
      called "isNodeHaveSubNodes" hardcoded to return true.

      Now, take this xhtml snippet:

      Outputtext says: <h:outputText value="#{node.nodeHaveSubNodes}"/><br/>
      <c:if var="nex" test="#{node.nodeHaveSubNodes}">If test says its true</c:if>
      Resulting evaluation: <h:outputText value="#{nex}"/><br/>

      This prints:
      Outputtext says: true
      Resulting evaluation: false

      What im I missing ? Is this a configuration issue with regards to JSTL jars and so forth ? I see that in the examples (like DVD store) uses the "choose when"-tags extensively but that too generates the same problem for me.

      Any ideas ?

        • 1. Re: Seam + Facelets: use of JSTL and if tests
          sonja löhr Newbie

          If something is wrong with your declaration of the standard core library, you should see the unresolved <c:if> tags in the html source of your output. How does your namespace-declaration for the core library look like?

          • 2. Re: Seam + Facelets: use of JSTL and if tests
            PÃ¥l Oliver Kristiansen Newbie

            They are like this:

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            <html xmlns="http://www.w3.org/1999/xhtml"

            However after further investigation I've found out that this only happens with within the ui:repeat (since the "node" object in question is within a collection).

            The facelets manual says something about JSTL support: " A note about EL within this JSTL implementation. Since all set variables from these tags are backed by the new EL API, the only scope they can bind to is within the current FaceletContext, no others. This means that variables only can exist for the benefit of creating the component tree for JSF and do not work to assign variables in other scopes. The reason for this is that the Expressions are actually bound to the FaceletContext, not the evaluted Object. This is to better serve JSF tree creation."

            I too new to all of this to really understand what that meant.

            Strickly speaking this dont seem to be a Seam issue so I wont post anymore on that issue. Thanks anyway.

            • 3. Re: Seam + Facelets: use of JSTL and if tests

              You might want to try a c:if c:set combo.

              Outputtext says: <h:outputText value="#{node.nodeHaveSubNodes}"/><br/>
              <c:if var="tmp" test="#{node.nodeHaveSubNodes}">
              <c:set var="nex" value="#{tmp}" />
              If test says its true
              Resulting evaluation: <h:outputText value="#{nex}"/><br/>

              I haven't tested this, but I think it's your next best shot.