ui中的varstatus属性:在jsf 1.2中重复

Arc*_*her 3 jsf facelets uirepeat jsf-1.2

如何在JSF 1.2中的ui:repeat中实现varstatus属性的功能?如果它不能在版本1.2中使用,那么获取arraylist的第一个和最后一个项目的可用选项有哪些?

请提供您的想法,帮助我.

Bal*_*usC 8

请改用JSTL <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>
Run Code Online (Sandbox Code Playgroud)

或者使用Tomahawk <t:dataList>代替.

<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>
Run Code Online (Sandbox Code Playgroud)