1 Reply Latest reply on Nov 10, 2006 7:49 AM by Pete Muir

    <c:if> and a composition inside it, bug?

    il121 Newbie

      Hello,

      I am using Facelets 1.1.11 (with JBoss seam 1.1 BETA1) and I faced the following problem.

      I have a composition that represents a row in a panel grid. (The panel grid has two columns.) The composition is responsible to display a label in the first column and to render a content into the second column this way:

      <ui:composition>
       <h:outputText value="#{label}:" />
       <ui:insert/>
       </ui:composition>


      The jsf page looks like this:

      ...
       <body>
       <h:form>
       <h:panelGrid columns="2">
       <brx:row label="input1">
       <h:panelGroup>
       <h:selectBooleanCheckbox title="checkbox" value="#{condition}"/>
       <h:outputText value="text for input1"/>
       </h:panelGroup>
       </brx:row>
      
       <c:if test="#{condition}">
       <brx:row label="input2">
       <h:outputText value="text for input2"/>
       </brx:row>
       </c:if>
      
       <brx:row label="input3">
       <h:outputText value="text for input3"/>
       </brx:row>
       </h:panelGrid>
      
       <h:commandButton value="Submit!" class="button" />
       </h:form>
       </body>
      ...
      

      (brx:row represents the composition in this sample.)

      So there are three rows, the second one is displayed only if the #{condition} expression evaluates to true (this is a JBoss seam bijected object).

      If condition is true, the panelgrid is rendered correctly, if condition is false, I would expect (after I submit the form) that the second row disappears. Instead of this, the first column of the second row remains visible(!), end the whole second column under the second row is shifted up by one (and the last row disappears). Illustration:

      (condition is true, right)
      input1: [X] text for input1
      input2: text for input2
      input3: text for input3

      (condition is false, wrong)
      input1: [ ] text for input1
      input2: text for input3

      It is interesing that if I change the test expression in c:if to the constant false value, the panel grid renders itself correctly.

      I guess it can be a facelets problem, because if I substitute the content of the composition into the page by hand, the page is rendered the right way.

      Could anyone help what the problem can be? Is it a bug in facelets or is it related to Seam in a way?

      Thank you in advance.

      Laszlo Illes