Ravi-
You need to look at the Collections API for storing your data. This will
teach you about TreeMaps, Lists and Comparators:
http://developer.java.sun.com/developer/onlineTraining/collections/Collectio
n.html
http://developer.java.sun.com/developer/technicalArticles/Collections/Using/
index.html
You will also need to understand Serialization and the Serializable
interface:
http://java.sun.com/docs/books/tutorial/essential/io/serializing.html
http://java.sun.com/products/jdk/1.2/docs/guide/serialization/
be sure to look at the examples and FAQ in the above link.
Kevin Baynes
SEAGULL Software
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ravi
> Shankar Jagarapu
> Sent: Wednesday, July 18, 2001 11:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Sorting using servlets
>
>
> Hi Mark,
>
> It would be great if you could give me an example
> code. I did not understand what you wrote? is there
> any article where I could read about that?
>
> I don't know what is a TreeMap. Could you enlighten
> me?
>
> Thanks,
> Ravi.
>
> --- Mark Galbreath <[EMAIL PROTECTED]> wrote:
> > Nah...that would not be efficient. Better to do it
> > on the server by sending
> > the data into a TreeMap (implements SortedMap) and
> > make it available to all
> > clients through a serialized download.
> >
> > Cheers!
> > Mark
> >
> > ----- Original Message -----
> > From: "Mike Peyvandi" <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 17, 2001 11:39 PM
> >
> >
> > > Another option would be an applet in the response
> > to take care of sorting
> > at
> > > the client side. This way you can omit some extra
> > calls to the server for
> > > sorting purpose.
> > >
> > > Mike
> > >
> > >
> > > -----Original Message-----
> > > From: Kevin Baynes
> > > Sent: Tuesday, July 17, 2001 2:43 PM
> > >
> > > Ravi-
> > >
> > > You could make the database call, save the results
> > into a temporary
> > > structure, put it where you can access it on the
> > next call. You can do
> > this
> > > by either saving it to the Session, or by
> > serializing it to a file and
> > > accessing it by some key that you save to the
> > Session.
> > >
> > > You could use Arrays, Vectors, Lists, or a custom
> > built object.
> > >
> > > I suggest you use Lists and Comparators for
> > storage and sorting.
> > >
> > > Kevin Baynes
> > > Seagull Software
> > >
> > > > -----Original Message-----
> > > > From: Ravi Shankar Jagarapu
> > > > Sent: Tuesday, July 17, 2001 12:39 PM
> > > >
> > > > I am retrieving data from the database with
> > several
> > > > fields, like for example first name, last name,
> > > > join date, salary.
> > > >
> > > > This data is displayed by the servlet.
> > > > Now my requirement, is that, if anyone clicks on
> > first
> > > > name, the data should now be displayed sorted on
> > that
> > > > field and if on salary then sorted on salary.
> > > >
> > > > I don't want to connect to the database each
> > time and
> > > > retrieve the same information just to sort the
> > data
> > > > which is already available to me.
> > > >
> > > > Can anyone suggest a better method? Would be
> > great if
> > > > you could give an example code.
> > > >
> > > > Many Thanks,
> > > > Ravi.
> >
> >
> __________________________________________________________________
> _________
> > 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
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> __________________________________________________________________
> _________
> 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