Sorry if my question is not clear. Let me explain - I have two lists, model.List1 & model.List2 of unequal sizes. However, I still need to display model.List2 in such a way that, the list elements appear under the Territory column. How do I merge these two lists? I somehow need to iterate List2 within the block marked with ** **
Edit: As you can see, List 1 has five entries while list 2 has only 3 entries. If I iterate my second list within my first list, for each Iteration of List1, I am getting all the 3 Territories (Please see SEC1). This is not what I want..
<table>
<thead>
**<tr>**
<th>User</th>
<th>Title</th>
<th>Role</th>
<th>Territory</th>
**</tr>**
</thead>
<tbody>
<c:forEach items="${model.List1}" var="list">
<tr>
<td>${list.name} </td>
<td>${list.title} </td>
<td>${list.role} </td>
</tr>
</c:forEach>
<c:forEach items="${model.List2}" var="terr">
<td>${terr}</td>
</c:forEach>
</tbody>
</table>
Current Output:
User Title Role Territory
user1 Lead Lead
Territory1
Desired Output:
User Title Role Territory
user1 Lead Lead Territory1
user2 Lead2 Lead2 Territory2
user3 Lead3 Lead3 Territory3
User4 Lead4 Lead4
User5 Lead5 Lead5
SEC1 - This is not what I want
User Title Role Territory
user1 Lead Lead Territory1 Territory2 Territory3
user2 Lead2 Lead2 Territory1 Territory2 Territory3
user3 Lead3 Lead3 Territory1 Territory2 Territory3