This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Format column display - JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Format column display - JSTL" Watch "Format column display - JSTL" New topic
Author

Format column display - JSTL

Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
I have a table that is currently displaying like so:



and now I would like for it to display like this:



Is there an easy way to get this format with the code below or should I just rework my backend code? Any direction on this matter would be appreciated. Thanks!

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

Of course there is. You can either change the format of the HTML such that you can still emit them in order, or you can do some math on the current loop index in order to pick and choose which array element gets emitted for each iteration.

Clues for the latter approach: varStatus gives you information on the current status of each iteration, including the loop index, and the [] operator can be used to index into the array or list. You might also ponder on the begin and end attributes to the <c:forEach> action.
[ March 14, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Format column display - JSTL
 
Similar Threads
Coloring Table Rows
How to prevent DIV from reloading
Coloring Table Rows Based on Array Value
Number of Table Rows Returning Double
JSTL List Help