You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Skip Hollowell <sk...@skipdaddy.com> on 2007/06/21 18:42:24 UTC

[S2]Paging through a large list of things

The power that be have dictated that a mega search against the DB will 
be fired off 1 time, and all the results will be returned to my Struts 2 
app for me to deal with.  (Rather than my suggestion of sending a 
request for 1 page worth of information as most people would suggest)

So now my question is ... how?  I have a list of 5000 records.  I want 
to initially show them a 100 of these records, with a nice Prev / Next 
feature. 

1.  Where / how do I safely store this list for this user?  Obviously it 
needs to be saved somewhere so it is not lost once the request is done.  
Is this something that should be dropped into the session?  Or is there 
a Struts way of doing things like this?

2.  As for tracking where in the list the paging is, I would assume I 
could store an iterator number to track what record was last displayed, no?

#1 is the piece I am truly looking for expert insight on, as the total 
list could be 10000 records or more.  (Don't ask me, I don't make their 
sandbox, I just play in it.)

Skip Hollowell



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2]Paging through a large list of things

Posted by Musachy Barroso <mu...@gmail.com>.
I've always used displaytag for paginated results. It is really easy to use
(and flexible at the same time)

musachy

On 6/21/07, Jeromy Evans <je...@blueskyminds.com.au> wrote:
>
> Skip Hollowell wrote:
> > So now my question is ... how?  I have a list of 5000 records.  I want
> > to initially show them a 100 of these records, with a nice Prev / Next
> > feature.
> > 1.  Where / how do I safely store this list for this user?  Obviously
> > it needs to be saved somewhere so it is not lost once the request is
> > done.  Is this something that should be dropped into the session?  Or
> > is there a Struts way of doing things like this?
> >
> As always, it depends.  You need to consider how big the records
> actually are, how many concurrent users you have and how interactive you
> want the user's experience to be.
>
> Here's some options:
> 1. store your results in the http session.  This takes no effort but
> won't scale very well.
> 2. Look at the paging implementation provided by displaytag.  The
> default behaviour loads all data and pages through it for you.
> http://displaytag.sourceforge.net/11/index.html
> 3. pass all the results to the client in one request.  Use a javascript
> widget to page through the results entirely on the client.  This would
> be great if its not too much data to download
> 4. if you're using an ORM framework like hibernate or toplink, enabling
> an object cache or query cache may achieve the effect you desire without
> having to write any custom code (WRT hitting the database once and then
> not needing to access it again for each page)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [S2]Paging through a large list of things

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Skip Hollowell wrote:
> So now my question is ... how?  I have a list of 5000 records.  I want 
> to initially show them a 100 of these records, with a nice Prev / Next 
> feature.
> 1.  Where / how do I safely store this list for this user?  Obviously 
> it needs to be saved somewhere so it is not lost once the request is 
> done.  Is this something that should be dropped into the session?  Or 
> is there a Struts way of doing things like this?
>
As always, it depends.  You need to consider how big the records 
actually are, how many concurrent users you have and how interactive you 
want the user's experience to be.

Here's some options:
1. store your results in the http session.  This takes no effort but 
won't scale very well.
2. Look at the paging implementation provided by displaytag.  The 
default behaviour loads all data and pages through it for you.  
http://displaytag.sourceforge.net/11/index.html
3. pass all the results to the client in one request.  Use a javascript 
widget to page through the results entirely on the client.  This would 
be great if its not too much data to download
4. if you're using an ORM framework like hibernate or toplink, enabling 
an object cache or query cache may achieve the effect you desire without 
having to write any custom code (WRT hitting the database once and then 
not needing to access it again for each page)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org