There are 2 ways of doing it.
1) The Server Side Sorting
U r using a bean to make a table rite? .. So all u need to make a bean which will make tables in sorted manner. for eg. U have a table having three columns User_name, User_email, Joining_date
So if i had to make a bean to generate a table. I would make three methods..
i) the default method where the whole table is sorted out by User_name
ii) The second method which will make a table by sorting User_email
iii) the third method will make a table sorting Joining_date
OR
U can have same method having three diffrent cases.. depending upon the values u pass to the bean,it makes the table.. This can get a bit complicated ,so i explained a simple but LENGTHY way first.
So now all u have to do is make links to the table headers in html which will call jsp file with a perticular parameter which can sent in query string for eg.. if the user clicks on User_email header in the table u call
2)Client Side sorting
Now the second way is dhtml thing in which u make all the three tables & hide 2 others in div or layers ( IE ,netscape comaptibility probs ) & when the user clicks
on which ever header u show the corresponding div or layer.
Well this dhtml thing is a bit too complex & depends on client browser so i wont prefer it.
So now its upto u, Which way to prefer. I hope this whole explanation will help u....
Cheers