Jsf Facelets重复标记索引

Jsf Facelets重复标记索引,jsf,jsf-2,facelets,Jsf,Jsf 2,Facelets,有人知道在ui:repeat-facelets标记中获取元素索引的方法吗 <ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}"> <h:outputText class="dream-title uppercase" value="#{dream.number}. #{dream.title}" /> </ui:repeat> 为“varStatus”属

有人知道在ui:repeat-facelets标记中获取元素索引的方法吗

<ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}">
    <h:outputText class="dream-title uppercase" value="#{dream.number}. #{dream.title}" />
</ui:repeat>

为“varStatus”属性指定一个值:

<ui:repeat id="..." var="..." value="..." varStatus="myVarStatus">
此外,以下属性可用于varStatus:

  • 整型开头
  • 整型结束
  • int型索引
  • 整型步长
  • 布尔型偶数
  • 布尔型奇数
  • 布尔类型的第一个
  • 布尔型的最后一个
有关详细信息,请参阅:


布赖恩的回答很好,但我认为它可能更具描述性

我们创建UI:Repeat

<ui:repeat id="repeatOne" var="listofValues" varStatus="myVarStatus"> </ui:repeat>
带有链接的其他文档:

  • 可以找到UI:Repeat的属性
  • <ui:repeat id="repeatOne" var="listofValues" varStatus="myVarStatus"> </ui:repeat>
    
    current     getCurrent()    The item (from the collection) for the current round of iteration
    index       getIndex()      The zero-based index for the current round of iteration
    count       getCount()      The one-based count for the current round of iteration
    first       isFirst()       Flag indicating whether the current round is the first pass through the iteration
    last        isLast()        Flag indicating whether the current round is the last pass through the iteration
    begin       getBegin()      The value of the begin attribute
    end         getEnd()        The value of the end attribute
    step        getStep()       The value of the step attribute