[jboss-user] [JBoss Seam] - Pagination With Query Objects Bug?

tazman do-not-reply at jboss.com
Thu Mar 1 07:00:04 EST 2007


Hi all!

I think I discovered a bug with the pagination logic of Query objects.

I have a query object comments defined in my components.xml. max-results param is set to 5 and I know that I have 10 comments in the DB. I can use the following code for the rendering of a "next page" link:

<s:link view="/comments.xhtml" rendered="#{comments.nextExists}" value="Next Page">
  |     <f:param name="firstResult" value="#{comments.nextFirstResult}"/>
  | </s:link>

Now, when I'm already browsing the second and last page, i.e. with firstResult param set to 5, a "next page" link is still there. When I click on "next page", firstResult is set to 10 and the query object returns an empty list.

I went through the Query.java code and found this implementation for isNextExists():

public boolean isNextExists()
  | {
  | 	return getResultList()!=null && 
  | 	getResultList().size() == getMaxResults();
  | 
  | }

I think this code should consider the resultCount as well, so that getNextFirstResult() doesn't return a value equal or greater than the resultCount.

Isnt't this the expected behavior for you guys?

tazman


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024210#4024210

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024210



More information about the jboss-user mailing list