0

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

Vinc
  • 695
  • 2
  • 10
  • 26
  • found this 'duplicate' after some very little searching in google... https://www.google.nl/search?q=uirepeat+varstatus+end Does this not result any good results for you? – Kukeltje Apr 08 '15 at 13:24
  • Thanks a lot, that answers my question 100%. Weird I kept getting results to ui:repeat documentation and examples on using it, very few stack overflow results at all. My wording was different though – Vinc Apr 08 '15 at 13:26

0 Answers0