To add a Mindwin answer, you need to understand that <c:choose> is a tag handler when <ui:repeat> is a user interface component. The first is evaluated when building the component tree, and the second is when viewing the view, that is, at a later time. In this light, the dependence on var on <ui:repeat> is what is wrong with your code, because it was not evaluated when you entered the game <c:choose> .
Two things to remember here.
Use the iterative tag handler, <c:forEach> , with your content:
<c:forEach items=#{bean.values} var="data"> <c:choose> <c:when test="#{data.thirdValue == 'content'}"> <h:outputText value="Wrong value"/> </c:when> <c:otherwise> Correct! </c:otherwise> </c:choose> </c:forEach>
With this approach, both tags are launched simultaneously (the view is built), so conflicts will not occur. Just remember that if your bean is viewable, it will be recreated for every request.
Use the user interface component with the rendered attribute:
<ui:repeat value=#{bean.values} var="data"> <h:outputText rendered="#{data.thirdValue == 'content'}" value="Wrong value"/> <ui:fragment rendered="#{data.thirdValue != 'content'}"> <h1>Correct</h1> </ui:fragment> </ui:repeat>
In this case, everything starts simultaneously (the view is visualized). Note that you can display a whole bunch of HTML, such as <ui:fragment> , as well as some specific JSF tags, such as <h:outputText> , using the rendered attribute.
Ultimately, continue the classic post: JSTL in JSF2 Facelets ... makes sense? to get a complete understanding of the relationship between tag handlers and user interface components.