I had no problems implementing it and the forums on sourceforge have been great.
Z.
Guido Garc�a Bernardo wrote:
Thank you very much.
I don't like the Brice Ruth idea of using the session to store the PaginatedList object.
Finally I've done it this way, using a ListWrapper instead of using a com.ibatis.common.util.PaginatedList.
My ListWrapper implements java.util.List and contains:
- isFirstPage/isLastPage/isMiddlePage, getPageIndex, getPageSize methods, so my JSP is 'compatible' with the previous aproach using PaginatedList.
- getRowCount, getPageCount, so now I can do a 'google like' paginated list.
Regards.
Fabrizio Gianneschi wrote:
I'm used to execute two queries (count + select) for each stament in this
kind of situations.
The code is hidden in the DAOs, so the business/web layers are not aware of
the strategy.
The following is the generic method I use:
private List executePagedQuery(Object params, int offset, int limit, boolean countResults, String query, String countQuery) {
List l = super.getList(query, params, offset, limit); if (countResults) { Integer size = (Integer) super.getObject(countQuery, params); ListWrapper wrapper = new ListWrapper(l, size); return wrapper; } else { return l; } }
"ListWrapper" is a simple java.util.List wrapper that espose a constructor,
used to inject the maximum number of results, which PaginatedList doesn't
expose.
I think you should put the two queries in the same transaction, also.
Regards, Fabrizio
-----Messaggio originale----- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Inviato: venerd� 18 marzo 2005 12.13 A: [email protected] Oggetto: PaginatedList & 'google like' results
Hi,
I am using ibatis PaginatedList functionality for paging through search
results,
and I would like to add the ability for a user to go to the last page of the
results
(something like Google results) instead of having to page through big result
sets as
it is done in JPetStore4:
<logic:notEqual name="orderBean" property="orderList.firstPage" value="true" > <a href="switchOrderPage.shtml?pageDirection=previous">PREV</a> </logic:notEqual> <logic:notEqual name="orderBean" property="orderList.lastPage" value="true" > <a href="switchOrderPage.shtml?pageDirection=next">NEXT</a> </logic:notEqual>
Is this possible or should I do two queries (my actual "select fields from..." and a new "select count(*) from...") to achieve it?
Thank you very much, Guido.
- Guido Garc�a Bernardo - [EMAIL PROTECTED] ITDEUSTO - Valladolid

