Hello
I have a servlet that creates results in a two dimentional array and then uses request.setAttr ibute to store it.
for example :
String[][] fullname = {{"name1", "surname1"},{"n ame2", "surname2"},{"n ame3", "surname3"} };
request.setAttr ibute("fullname ",fullname) ;
Then JSP page will use JSTL c:foreach to display it:
<c:forEach var = "itemarr2" items = "${fullname }">
<tr>
<td>${itemarr 2[0]}</td>
<td>${itemarr 2[1]}</td>
</tr>
</c:forEach>
The above is working fine, except that in this case I know the array has two columns, but in many cases I don't know how many columns I have. Is there a way to make column numbers dynamic ?
Or may be another tag or method to solve this problem ?
Thank you
Lisa
I have a servlet that creates results in a two dimentional array and then uses request.setAttr ibute to store it.
for example :
String[][] fullname = {{"name1", "surname1"},{"n ame2", "surname2"},{"n ame3", "surname3"} };
request.setAttr ibute("fullname ",fullname) ;
Then JSP page will use JSTL c:foreach to display it:
<c:forEach var = "itemarr2" items = "${fullname }">
<tr>
<td>${itemarr 2[0]}</td>
<td>${itemarr 2[1]}</td>
</tr>
</c:forEach>
The above is working fine, except that in this case I know the array has two columns, but in many cases I don't know how many columns I have. Is there a way to make column numbers dynamic ?
Or may be another tag or method to solve this problem ?
Thank you
Lisa
Comment