[ http://jira.codehaus.org/browse/DISPL-122?page=all ] fabrizio giustina closed DISPL-122: -----------------------------------
Resolution: Duplicate see DISPL-122 and DISPL-129 > Increase efficiency paging using a subset (patch included) > ---------------------------------------------------------- > > Key: DISPL-122 > URL: http://jira.codehaus.org/browse/DISPL-122 > Project: DisplayTag > Type: Improvement > Components: Paging/Sorting > Versions: 1.0 RC2 > Reporter: fabrizio giustina > Fix For: 1.1 > Attachments: DISPL-122.diff > > > ==== > imported from sf tracker > id 1013526 > submitted by Will Glass-Husain - wglass > http://sourceforge.net/support/tracker.php?aid=1013526 > ==== > [This really belongs in issue#872183 but I couldn't figure > out how to add another file to the issue.] > The dilemma - how to efficiently display a large list (e.g. > 20,000 rows) one page at a time. Currently, to take > advantage of DisplayTag's paging features, you must > generate the entire list each request. > This patch allows the application to control the > selection of the specific sublist, with DisplayTag > automatically generating the PREV/NEXT links as usual. > For an MVC environment pulling large lists out of a > database this can be used to implement significant > performance improvements. > There's already a patch solving the same problem in the > issue tracker (#872183), but I've made an alternate > implementation (not having seen the first proposal at > the time). This particular patch may be easier to > integrate than the previous one (being based on a more > recent version of DisplayTag). It is fully backwards > compatible, works with EL tags, and is configurable with > DisplayTag properties rather than any new attributes. > Using it is not too complicated, although it requires > coordination between the Controller code and the JSP > page. There are two new DisplayTag properties: > paging.manual (true/false, default: false) > paging.manual.prefix (default "d") > In order to produce a table, the controller must > generate the sublist, calculate the size of the full list, > and pass both pieces of info to DisplayTag. (both are > required for paging). The size of the full list is passed > by setting a pageContext attribute with the name of "d- > size". (or X-size, if X is the prefix specified with > the "paging.manual.prefix" property). DisplayTag will > display the sublist amd will also generate page hyperlinks > for the full list. Each hyperlink will contain a request > parameter "d-p", e.g. "d-p=2". (This is similar to the > standard page parameter which is typically something > like "d-2911-p=2"). When the hyperlink is clicked, the > controller should note the new page number and send > along a new sublist. > Example pseudo code: > CONTROLLER: > int pagesize = 10; > int fulllistsize = <count the size of the full list> > List sublist = <generate sublist for the particular page, > based on a page size of 10> > pageContext.setAttribute("list",sublist); > pageContext.setAttribute("d-size",fulllistsize); > JSP PAGE: > <display:table name="${list}" pagesize="10"> > <display:setProperty name="paging.manual" > value="false" /> > .. all the display columns > </display:table> > A key issue the patch had to address is how to > distinguish one TableTag from another if there are > multiple instances on the same page. This is normally > done with an automatically generated id. In this case > however, since the request parameters must be > recognized by the controller to generate the sublist, the > id is skipped and the prefix (specified in the properties) > is used instead. Thus it is up to the page designer to > use different prefixes for different DisplayTag tables on > the same page. > I'd welcome any comments. > Note: this patch was made against nightly build of 8-16- > 04, 1.0-rc2 SNAPSHOT. > ====== > Date: 2004-09-13 21:48 > Sender: ralfhauser > Logged In: YES > user_id=266141 > see also another solution in > http://sourceforge.net/tracker/index.php?func=detail&aid=1026408& > group_id=73068&atid=536613 > ==== > Date: 2004-09-07 03:50 > Sender: ianbdev > Logged In: YES > user_id=461701 > Hello, > I posted the 872183 request. > Since then we've come up with an alternate approach. > See [ 1023387 ] Pagination - use subList instead of iterating > all records. > If this change is implemented then you can implement a List > object that overrides the subList method of the List interface. > This would allow you to limit database/datasource accesses > to obtain just the few page records required for the page > being displayed. > No other changes to display tag are required. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel