Jyoti -

If you are just looking for algorithms for sorting, there are plenty. Refer to the
links for some demo and sample codes at some of the links.

http://www.cs.hope.edu/~alganim/ccaa/harrison.html
http://www.epaperpress.com/s_man.html
http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html
http://www.cs.usask.ca/research/research_groups/aries/projects/applets/tutorials/sorting/quick/

The selection of a sorting algorithm depends upon

(a) how many rows you are displaying in the table per page? If there are 10 or 20,
it would be better if u go with the simple sorting algorithm such as insertion sort
or selection sort.  If you are displaying many rows, then quicksort would be
helpful.

(b) once the user clicks on the column, do u sort the whole cached data? or just
the selected page? I guess that also dictates the sorting mechanism.

Also I have a couple of questions to you.

1. CachedRowSet - is this an object containing 13 fields (columns)? If that is the
case, the column clicked by the user will be your key, and u sort these objects
based on that key.

2. CachedRowSet - is it *html link data with TR and TD tags? In that case, you will
have to manipulate the formatted *html data to do the sorting.

3. Also, where do u plan to implement this sorting algorithm? In the web server
layer? or in the layer where u r actually getting the data from the database?

good luck

- jasthi



Jyoti Bongarala wrote:

> HI all,
>
> My problem is I am looking for an algorithm or a
> program that would do the following :
>
> 1. Once I retrieve a resultset from the database, I
> store it in a CachedRowSet. And when I display it ,
> the user should be able to sort the data by any column
> (total columns retrieved are 13) and this sorting has
> to be done (outside the database)
>
> Please somebody help me with this or give me a
> lead....
>
> thanks,
> Jyoti
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to