<ui:fragment rendered="#{...}">
<p class="#{current.index eq 0 ? '' : 'someClass'}">
Some Text
</p>
</ui:fragment>
.....
<ui:fragment ...>
<p class="#{current.index eq 0 ? '' : 'someClass'}">
...
</p>
....
</ui:fragment>
How do I get the index of current ui:fragment in the above facelet?
You're hardcoding them instead of using an iterating component like <ui:repeat>
or so, so there's no index available in the scope. Just either hardcode the index as well, or use an iterating component like <ui:repeat>
wherein the index is available by the varStatus
reference.
<ui:repeat value="#{bean.list}" var="item" varStatus="loop">
<p>#{loop.index}</p>
</ui:repeat>