samedi 9 mai 2015

JSF invalid behavior with jstl foreach with different jsf version

I am not really sure how should I describe the problem. I am currently learning JSF, and today tried to implement something like ajax reloaded table with pagination.

Here is my code in JSF:

<c:forEach var="pageNo" begin="0" end="${adapter.pagesNumber}">
<c:choose>
    <c:when test="#{adapter.currentPage == pageNo}">
        <li class="active"><h:commandLink value="#{pageNo+1}" disabled="true" /></li>
    </c:when>
    <c:otherwise>
        <li><h:commandLink value="#{pageNo+1}" action="#{adapter.setCurrentPage(pageNo)}">
                <f:ajax render=":#{cc.attrs.tableId} @form" />
            </h:commandLink></li>
    </c:otherwise>
</c:choose>

And I am using JSF from:

<dependency>
     <groupId>org.glassfish</groupId>
     <artifactId>javax.faces</artifactId>
 </dependency>

My intention was to have buttons with page numbers, with currently active page button highlighted and disabled (no same page reloading).

Now, first screenshot shows my view before any action: (first page): enter image description here

Lets say I clicked on page number 6,

And now, when I use JSF with version

     <version>2.2.4</version>

I got expected result: enter image description here

But when I switch on versions above e.g.

     <version>2.2.5</version> // tested up to 2.2.11

I'm getting something like this: enter image description here

After I've clicked on page no 9 i got another "pagination" sequence:

1 2 3 4 5 7 8 9 6 10 11

but the current page in left bottom corner says it's 9th page. Table content is valid too.

Does anyone have ever faced with situaton like this or what am I doing wrong, if the same code works totally different with different JSF versions? What can be a reason of such weird behavior?

Aucun commentaire:

Enregistrer un commentaire