• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 2
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
expectation is the root of all heartache - shakespeare. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic