aspose file tools*
The moose likes Spring and the fly likes how to iterate (use another c:foreach or similar ) inside c:foreach in spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "how to iterate (use another c:foreach or similar ) inside c:foreach in spring" Watch "how to iterate (use another c:foreach or similar ) inside c:foreach in spring" New topic
Author

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

David Richard
Greenhorn

Joined: Nov 07, 2011
Posts: 2

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

Joined: Oct 11, 2011
Posts: 98
Hi,
Spring support c:forEach inside a c:forEach .
There may be problem with the data you are passing to the JSP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to iterate (use another c:foreach or similar ) inside c:foreach in spring
 
Similar Threads
Binding to multi-D array
How to build a table with nested foreach loops
forEach prints Address Location
JSTL/EL Nested expression (within nested forEach) Issue
JSP column name hyperlink help