Re: Paginating through entire collection on 'Next', 'Last' etc. Paslaru was kind enough to reply to my question regarding displaytag's looping through an entire collection to get 'Last', 'Next' etc by adding "reload=false" to the requestURI param. However, the results remain the same. For example, given the following table declaration:
<display:table name="sessionScope.list" export="false" id="row" requestURI="/kw/agentSearchNext.do?reload=false" sort="page" pagesize="50"> <display:caption>Agent Search Results</display:caption> <display:column property="officeName"/> <display:column property="city"/> <display:column property="stateProvId"/> <display:column property="officePhone"/> <display:column property="lastname"/> <display:column property="firstname"/> <display:column property="email" autolink="true"/> <display:setProperty name="sort.behavior" value="list" /> <display:setProperty name="paging.banner.placement" value="top" /> </display:table> The table references an ArrayList that is placed in the session as expected. The pagination menu follows: 910 items found, displaying 301 to 350.[First/Prev] 3, 4, 5, 6, 7, 8, 9, 10 [Next/Last] "/kw/agentSearchNext.do?reload=false" is called from the pagination menu. The entire collection is iterated over to find the next 50 records. My question is this: Why isn't the collection sliced into groups of 50 records so that a subgroup of records can easily be found? Is this possible or is the behavior I'm seeing the default behavior for the tag? I see mentions of a PaginatedList but no examples of how to implement it. Thanks, Bill -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, January 05, 2007 5:50 PM To: displaytag-user@lists.sourceforge.net Subject: displaytag-user Digest, Vol 9, Issue 9 Send displaytag-user mailing list submissions to displaytag-user@lists.sourceforge.net To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/displaytag-user or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of displaytag-user digest..." Today's Topics: 1. Re: Pagination without going through entire collection repeatedly? (Paslaru Narcis Eugen) 2. Example of Implementing PaginatedList (Ferguson, Jason M TSgt 805 CSPTS/SCE) 3. display:table column bean retrieval? (Bill Blackmon) ---------------------------------------------------------------------- Message: 1 Date: Fri, 5 Jan 2007 13:42:12 -0800 (PST) From: Paslaru Narcis Eugen <[EMAIL PROTECTED]> Subject: Re: [displaytag-user] Pagination without going through entire collection repeatedly? To: displaytag-user@lists.sourceforge.net Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="windows-1252" If you want to avoid the reloading of element you sholud probably set the requestURI="/kw/agentSearchSubmit.do?reload-=false" and in the action you could check the parameter and take the results straight from the session, but then you risk not to be in synchronization with the database... Regards, NArcis Paslaru ----- Original Message ---- From: Bill Blackmon <[EMAIL PROTECTED]> To: displaytag-user@lists.sourceforge.net Sent: Friday, January 5, 2007 7:59:49 PM Subject: [displaytag-user] Pagination without going through entire collection repeatedly? <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 { font-family:Arial; color:windowtext;} _filtered { margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {} --> I?ve managed to get a collection (ArrayList) loaded into a displaytable. The pagination works correctly. However, the entire collection is reloaded everytime the pagination is called (this is because the Struts action that initially loads the collection is called over and over). How do I get around this? // taken from action class ArrayList results = shortAgentDataAccess.getResults(); session.setAttribute("list", results); The list returns 2049 records that are ALL loaded at startup. The table is defined as follows: <display:table name="sessionScope.list" export="true" id="row" requestURI="/kw/agentSearchSubmit.do" pagesize="50"> I?d prefer to have it set at requestScope, but I?m using session for testing. The requestURI is the Struts action that is called repeatedly when the paging is activated. The records paginate correctly ? next goes to next, last goes to last etc. HOWEVER, everytime the pagination is called the entire list is loaded again. I know there must be a way to get around this but have no idea how to do it. I imagine I need a PaginatedList collection and I need to pass parameters into it but there are no examples (or at least any that I can find after Googling all morning)of how to do this in a servlet or action class. Thanks, Bill ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE V _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://sourceforge.net/mailarchive/forum.php?forum=displaytag-user/attac hments/20070105/b2c9554e/attachment.html ------------------------------ Message: 2 Date: Fri, 5 Jan 2007 16:58:54 -0600 From: "Ferguson, Jason M TSgt 805 CSPTS/SCE" <[EMAIL PROTECTED]> Subject: [displaytag-user] Example of Implementing PaginatedList To: <displaytag-user@lists.sourceforge.net> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" I'm giving an in-house training presentation next week on usage of DisplayTag, including some of the Partial List functionality. Does anyone have any (relatively simple) examples of a PaginatedList class? Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: http://sourceforge.net/mailarchive/forum.php?forum=displaytag-user/attac hments/20070105/00383d8e/attachment.html ------------------------------ Message: 3 Date: Fri, 5 Jan 2007 18:23:50 -0500 From: "Bill Blackmon" <[EMAIL PROTECTED]> Subject: [displaytag-user] display:table column bean retrieval? To: displaytag-user@lists.sourceforge.net Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii Hi, How does one call a method on the current object in the list assigned to a display:table? For instance, using the current bean in the collection ('this'), I need to get the bean's 'address' property. From the 'address' property I need to get the 'address1' property (and city and state and zip and country afterwards). Is this possible? This is what I've tried and it obviously doesn't work: <display:table name="sessionScope.list" export="false" id="row" requestURI="/kw/advancedOfficeSearchNext.do" sort="page" pagesize="<%=rowsToRetrieve%>"> // problem column definition <display:column property="<%=this.getAddress().address1%>" title="Address"/> Thanks! ------------------------------ ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE V ------------------------------ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user End of displaytag-user Digest, Vol 9, Issue 9 ********************************************* ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user