jstl for loop

hi

i want to create a table: the table will only have as many rows as a varable states, i want to create the for loop using jstl

if i have a varable containing the row amount like:

<c:set var="rows" value="2" />

how wud i use a for loop to loop the loop as many times as the rows varable?

[325 byte] By [h1400046a] at [2007-11-26 15:25:20]
# 1

You would use the attributes of the forEach tag: being / end

<c:forEach var="item" items="${myListOfItems}" begin="0" end="${rows}">

If you are doing "paging" then you can give dynamic values for both begin and end, based on where you are in the list, and how many entries you want to display.

Cheers,

evnafets

evnafetsa at 2007-7-8 21:40:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

tried this but no luk it produces 0 rows

<c:set var="rows" value="2" />

<c:forEach var="item" items="${myListOfItems}" begin="0" end="${rows}">

<tr>

<td>

Company

</td>

</tr>

</c:forEach>

h1400046a at 2007-7-8 21:40:54 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
this works <c:set var="rows" value="2" /><c:forEach var="item" begin="1" end="${rows}">
h1400046a at 2007-7-8 21:40:54 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...