I have a <ui:repeat>
setup as follows :
<ul>
<ui:repeat id="iterator" value="#{myBean.linkList}" var="link" varStatus="linkStatus">
<li>
<ui:fragment rendered="#{!linkStatus.first and myBean.currLink.type eq 'comm'}">
<p:commandLink id="commLink" value="Test" onclick="commLinkClicked(#{linkStatus.index}, #{linkStatus.end});"></p:commandLink>
</li>
</ui:fragment>
</ui:repeat>
</ul>
As you can see I send the index of the current object aswell as the last
index of the list to a javascript function.
The problem is the #{linkStatus.index}
resolves to the correct value, but the #{linkStatus.end}
resolves to nothing.
This ofcourse results in a syntax error as follows
SyntaxError: expected expression, got ')'
I have looked at the source code of UIRepeat and IterationStatus and as far as I can see varStatus.end
is implemented and used.
This list in the backing bean is defined as follows :
private List<MyLink> links;
This list is initiated on load from the database with a DAO class that returns Query.list();
directly.
The relevant part of my pom follows :
<!-- JSF -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
I am also using Primefaces 5.0, but I doubt that would be causing any issues with a select part of the