Iterate over column rather than rows over arraylist in JSP
-Earlier I wanted to a display data in tabular manner as follows
Col 1 Col 2 Col 3 Col4 Col 5 Col 6 Col 7 Col 8 Col 9 Col 10
8-Jul-13 99.88 10.18 0.5 1.5 0.32 18.26 3.75 24.00 250 99.58
9-Jul-13 250 9.88 1.8 2.5 0.35 3.2 99.26 3.75 244.00 12 2-Jul-13 998 0.18
0.75 1.3 0.32 81.26 3.75 244.00 250 99.58
and the HTML code with jsp scriplets is as shown
this below code is a part of my display.jsp which gets gets from bean class
{
<tr style="padding-top: 5px">
<td></td>
<td>col1</td>
<td>col2</td>//code to display as table
<td>Col3</td>
<td>col4</td>
<td>col5</td>
<td>col6</td>
<td>col7</td>
<td>col8</td>
<td>col9</td>
<td>col10</td>
</tr><%
<tr>
<% List colList=dataBean.getResult();
Iterator colListIterator = colList.iterator();
UserBean user;
while ( colListIterator.hasNext() ) {
user = ( UserBean ) colListIterator.next();
<td><%=dat%></td>
<td><%=col1%></td>
<td><%=col2%></td>
<td><%=col3%></td>
<td><%=col4%></td>
<td><%=col5%></td>
<td><%=col6%></td>
<td><%=col7%></td>
<td><%=col8%></td>
<td><%=col9%></td>
<td><%=col10%></td>
</tr><% } %>
}
Now my requirement has changed...the table shown above is to be dispalyed as
8-Jul-13 9-Jul-13 2-Jul-13
Col1 99.88 9.88 988
Col2 10.18 1.8 0.18
Col3 0.5 2.5 0.75
Col4 1.5 0.35 1.3
Col5 0.32 3.2 0.32
Col6 18.26 99.26 81.26
Col7 3.75 3.75 3.75
Col8 2414 2414 2414
Col9 250 250 250
Col10 99.58 99.58 99.58
Please help me in changing the code as per my requirements
No comments:
Post a Comment