This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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
subject: Pulling a list of vendors and displaying them into columns JSP Functions