0

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.

2
  • That's great and all, but you'll need to form a question if you want help. Ideally you would show us your approach and what is limiting you from implementing your solution. Commented Aug 17, 2012 at 16:31
  • @DMoses Thanks. I have changed my post into a question now. Commented Aug 17, 2012 at 16:33

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.