Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 3154 invoked from network); 22 Mar 2005 09:00:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Mar 2005 09:00:18 -0000 Received: (qmail 22138 invoked by uid 500); 22 Mar 2005 09:00:17 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 21926 invoked by uid 500); 22 Mar 2005 09:00:17 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 21911 invoked by uid 99); 22 Mar 2005 09:00:16 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from host101-123.pool21759.interbusiness.it (HELO mail.gruppoatlantis.com) (217.59.123.101) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 22 Mar 2005 01:00:14 -0800 Received: (qmail 15086 invoked from network); 22 Mar 2005 09:00:09 -0000 Received: from unknown (HELO atlantis079) (fabriziog@[217.59.123.100]) (envelope-sender ) by 0 (qmail-ldap-1.03) with SMTP for ; 22 Mar 2005 09:00:09 -0000 From: "Fabrizio Gianneschi" To: Subject: R: R: PaginatedList & 'google like' results Date: Tue, 22 Mar 2005 10:00:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <423EA08A.3090207@conads.com> Importance: Normal X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I like displaytag, too, but I was not able to use it in this case ('Google like' list), because it doesn't have a way to force by hand the number of results returned by the count query. If I remember well, page numbers were autocalculated by the tag itself, using the list passed as a parameter. So we switched to another less featured but simpler tag (Pager Taglib) and used displaytag only for small lists. It would be great if you have a working solution that we didn't found... Is this thread starting to be a little off-topic? :) Fabrizio -----Messaggio originale----- Da: Zoran Avtarovski [mailto:zoran@conads.com] Inviato: luned� 21 marzo 2005 11.23 A: ibatis-user-java@incubator.apache.org Oggetto: Re: R: PaginatedList & 'google like' results DisplayTag (http://displaytag.sourceforge.net/) in combination with iBatis is fantastic. You don't have to store the list in the session and if you design your app well the ibatis cache reduces your db hits to a minimum, improving performance. Plus it has host of added extras such as dynamic sorting, exporting different formats, grouping and a load more. 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: ggb275@tid.es [mailto:ggb275@tid.es] >> Inviato: venerd� 18 marzo 2005 12.13 >> A: ibatis-user-java@incubator.apache.org >> 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: >> >> > value="true" > >> PREV >> >> > value="true" > >> NEXT >> >> >> 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 - ggarciab@itdeusto.com > ITDEUSTO - Valladolid >