> -----Original Message-----
> From: Donie Kelly [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 07, 2005 10:39 AM
> To: Struts Users Mailing List
> Subject: Paging through a collection on a page
> 
> 
> HI all
> 
>  
> 
> Anybody got some sample code that allows me to display 
> multiple pages from a
> collection with next and previous page links. The collection 
> is stored in
> the form class so I’m wondering how easy this is to do. If 
> there are some
> samples on the web I’d be interested in having a look. I’m 
> not interested in
> display tag or one of those. I just need it to be simple and
> straightforward.

It depends on what you mean by easy, and how big your items are.  You can just 
store them in the session context if they are small enough, otherwise, you'll 
have to monkey around with retrieving just the result set you want.
I typically use a link to an action, with a parameter called page.  Page can be 
next or previous.  If it's next, I take the next pagefull and put it in the 
list to be displayed.  Typically I use the same action that grabbed the list to 
begin with, so that if the list grows larger then can be stored in memory I can 
easily modify the code.
I also typically use two session variables, one is the entire list and one is 
the list to be displayed.  This supports modificatio to an entirely DB centered 
list ( don't need to use the entire list session variable).

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to