Hi All, Wondering what peoples opinions are about the best way to sort a list of Java objects. I will have an HTML table (on a page of a web app) of data where the data is sorted within groups. I will populate the data with a list of java objects. For example, I may have a table that is sorted by last name, and grouped by level as follows :
Name Level Age Adams 1 29 Woods 1 26 Butler 2 21 Thomas 2 28
If the user clicks on Age, then the table must be sorted by age, but retain the grouping by level, as follows:
Name Level Age Woods 1 26 Adams 1 29 Butler 2 21 Thomas 2 28
My question is this. Is it better to store the data in an object in the session, and sort it on server side using comparators when the user clicks on a table column heading, or is it better to just hit the database again, and let sql do the sorting. Because this is not just straight sorting, but sorting within groups, I am leaning towards just hitting the database with new sql that contains the requested sort and group info. Does this sound like a good idea? There should be less than 100 items per list, so I dont think it will be too expensive to hit the database each time.
Thank you so much for your replies, this is a big help.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com