I'm trying to display a table that looks something like this:
I'd like to do this using Struts tags without using nested tables (because some user agents have difficulty with nested tables.) Any ideas in how to do this using Struts?
Two approaches I thought of: 1) I know how to do this if I know the # of grouped rows when I read each one. For example if I know there are two grouped rows, I can set the colspan to two. Do I need some kind of custom iterator to get access to this information?
2) Another way would be to store the data in a nested data structure. Then I could get the size of the nested list. But I'd need to get the first nested value separate from the rest of them.
Sorry about the poor ASCII art. When I hit refresh, it displays properly. If the table doesn't display, the gist of it is that there a single account can have several rows of values. But the account # amd amount span all of those rows.
Got it. I need to create the a custom data structure that can return the rowspan, the first nested row and a collection of all the other nested rows. Then, I can use Struts tags and keep code out of my JSP.
------------------------------------------------- Instead of using rowspan, you could also iterate over the data elements in account#1, field#1 and enter a <br /> after each. One advantage to this is that it would work for a variable number of elements.
e.g. <tr> <td>account #1<td> <td>a<br />c</td> <td>b<br />d<td> <td>555.00</td> </tr>