JSF facelet conditional rendering: use <ui:fragment> instead of <c:if> 

Joined:
08/13/2009
Posts:
172

December 03, 2011 12:12:22    Last update: December 03, 2011 12:14:38
I wrote about this before and I'm writing about it again. Because I fell for it for the second time!

This does not work:
<ui:repeat var="item" value="items" varStatus="status">
    <c:if test="#{status.first}">
        This is the first item!
    </c:if>
</ui:repeat>


Use this instead:
<ui:repeat var="item" value="items" varStatus="status">
    <ui:fragment rendered="#{status.first}">
        This is the first item!
    </ui:fragment>
</ui:repeat>
Share |
| Comment  | Tags