The tricky bit is the ordering.
Printing out an HTML table, you normally specify a row at a time, rather than data for each column.
You want to do the transpose of that - all of column 1, then column2, then column3
To make the generation of the HTML easier, I would transform your list into a datastructure that mimics the layout of that table, and then print from that
- It could be a 2 dimensional table with some entries being blank
- It could be a List of rows then columns with null placeholders for a blank column.
You might find the subList function in List useful.
Here is some simple stupid java code that does something along those lines.
It takes the originally sorted list, and fiddles it into a list that can then be iterated over to produce your table (assuming new row after every 3 columns)
It is by no means perfect and not flexible at all, but may give you a couple of ideas.
subject: Pulling a list of vendors and displaying them into columns JSP Functions