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

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

    il121 Newbie


      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:

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

      The jsf page looks like this:

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

      (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