Wiederholung in JSF mit JSTL

  • Beitrags-Autor:
  • Beitrags-Kategorie:Sonstiges
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
<c:forEach items="#{theView.theses}" var="x">
    <c:choose>
        <c:when test="#{x.state eq 'NEED_FOR_ACTION'}">
            <li style="color: darkred;">#{x.message}</li>
        </c:when>
        <c:otherwise>
            <li style="color: slategray;">#{x.message}</li>
        </c:otherwise>
    </c:choose>
</c:forEach>
<ui:repeat value="#{theView.theses}" var="x">
    <li>
        <h:outputText rendered="#{x.state eq 'NEED_FOR_ACTION'}" value="action"/>
        <h:outputText rendered="#{x.state ne 'NEED_FOR_ACTION'}" value="no action"/>
    </li>
</ui:repeat>

siehe auch: <c:forEach> vs <ui:repeat> und https://stackoverflow.com/