Reputation: 5128
I have a sorted Set of String and I need to display it using jsp/html.
How can I display it in the following format using JSTL or struts tags? This list in the display will grow sideways instead of top to bottom. I was thinking about having 25 rows and N number of columns(which increases as the size of the set increases).
AAB CCD FAA
ABA CCE FAB
ABB CDE FBB
BAA DAA FCC
BAB DAB FDD
BBB DBA FEE
CAA DDD FFF
CBA EAA
CBB EAB
Thank you for the help.
Upvotes: 0
Views: 1249
Reputation: 5858
I'll give you some psudo-code if you want. You can transplate this into any language you want php, java's jstl, etc.
Let's say we want to produce : http://jsfiddle.net/vQyyB/
for (i = 0, i < strings.count, i++) {
if (i % itemsPerColumn == 0) {
if (i != 0) print "</div>"
print "<div class='container'>"
}
print "<div class='foo'>" + string[i] + "</div>"
}
If all you needed was a starting point, I hope that helps. You can implement this using <c:forEach>
if you want to use jstl.
Upvotes: 1