I need to have result set on a page where the user can sort on the column headers. Any ideas?
Author: Poornima Singh (http://www.jguru.com/guru/viewbio.jsp?EID=555639), Nov 21, 2001 I had done the very same thing a couple of weeks back. i had a jsp page which was display the result set and i had to sort by the column header. I had the sql query built in the jsp page on which the selection crietria was done. Here I set the session variable. session.setAttribute(“ssql”,sql); The column Names, had a “href link” with the same request parameter ,but equaled to different Ints and checked the values in the jsp page in a switch case stmt. switch(nsortby) { case 1: { orderby=” order by cum “; break;} case 2: { orderby=” order by ctitle “;break;} case 3: { orderby=” order by cnames “;break;} } Some like this and then , add this string to the SQl string which is in the session with is retirved by, sessSQL=(String)session.getAttribute(“ssql”); And excute it as ususal. It really worked cool with me. All the best !