I'm currently fighting a little bit with JSF. I want to display a list of items. Each item can be displayed with 2 facelets (one if the item is editable and one otherwise).
Code snippet:
<div>
<c:forEach items="#{bean.itemList}" var="item">
<c:choose>
<c:when test="#{bean.isEditable(item.id)}">
<ui:include src="#{item.editableFaceletPath}>
<ui:param name="item" value="#{item}" />
</ui:include>
</c:when>
<c:otherwise>
<ui:include src="#{item.normalFaceletPath}>
<ui:param name="item" value="#{item}" />
</ui:include>
</c:otherwise>
</c:choose>
</c:forEach>
</div>
This works fine as long as I don't set an item to editable. However if I have 3 items: item1, item2 and item3, and I set item1 to editable, I'll get item2, item2, item3 displayed.
I understand why it doesn't work but I have absolutely no idea how I could implement it otherwise. Has anyone an idea how?