Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to iterate (use another c:foreach or similar ) inside c:foreach in spring

 
David Richard
Greenhorn
Posts: 2
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
our program has a object which hold a list of list.
*********existing code *******************

class Row
{
list<string> dataColumn;
}


class Table
{
list<row> dataRow;
}

------------ so to reach the dataColumn value in spring jsp, I have to iterate twice using foreach loop ------- something like
<c:foreach items="${model.table}" var="row" />
<tr>
<c:foreach items="${row}" var="column" />
<td><c:out value="${column}" /></td>
</c:forEach
</tr>
</c:forEach

--------------the problem --- spring is not allowing the innner foreach loop --------------

the work around's like... changing the Row class to somthing as below are tedious as the number of column are dynamic ----
class Row
{
string dataColumn1;
string dataColumn2;
string dataColumn3;
}

--------------------------------
thanks for any inputs...

-------------
is there any way i can output my data in jsp with out changing my Row class.
 
Miku Ranjan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Spring support c:forEach inside a c:forEach .
There may be problem with the data you are passing to the JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic