Re: handling result sets in random order across pages

Michael Weller <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <001401c2f938$56565b20$0207b9d9@gutschimachine>
Collections.shuffle(List,Random) is what you're searching. Eighter shuffle
your list of results, or shuffle a list of keys to access a map of results
in a random order. Put this list in the users session to access it whenever
your servlet's asked to serve the next "result page".
For the "several pages" thing search the archives for "page-by-page
iterator" if you don't know how you want to do that, yet.

HTH!

-mw

----- Original Message -----
From: "Carter, Scott" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 02, 2003 5:27 PM
Subject: handling result sets in random order across pages


> My problem is really very simple but I am not sure what the best way to
> solve it is.  I perform a query against my database, which always returns
my
> results in the same order, and I want to randomize the ordering.  The only
> other part of this problem that makes it tricky is I am not displaying all
> of the results on a single page, so how ever I decide to manage the
> randomizing of the result set order, I have to keep up with it over
several
> pages.  Any ideas?  Has anyone done this?
>
> Thanks - Scott Carter
>
>
___________________________________________________________________________
> To unsubscribe, send email to [email protected] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.