Varstatus attribute in ui: repeat in jsf 1.2

How to implement varstatus attribute functionality in ui: repeat in JSF 1.2? If it cannot be used in version 1.2, what are the available options for getting the first and last element of the array?

Please help me by submitting your ideas.

+3
source share
1 answer

Use JSTL instead <c:forEach>.

<c:forEach items="#{bean.items}" var="item" varStatus="loop">
    <c:if test="#{loop.first}">First</c:if>
    <h:outputText value="#{item}" />
    <c:if test="#{loop.last}">Last</c:if>
</c:forEach>

Or use Tomahawk <t:dataList>instead.

<t:dataList value="#{bean.items}" var="item" rowCountVar="count" rowIndexVar="index">
    <h:outputText value="First" rendered="#{index == 0}" />
    <h:outputText value="#{item}" />
    <h:outputText value="Last" rendered="#{index + 1 == count}" />
</t:dataList>
+8
source

All Articles