问题描述:

I am displaying certain record on a jsp page using a FOREACH loop. it takes parameters begin and end. i want to pass dynamic parameters in them

like this:

<%! int i=5; int j=10; %>

<c:ForEach var="ad" item="Products" begin="i" end="j">

<table>

<tr>

<td>${ad.id}</td>

<td>${ad.name}</td>

</tr>

</table>

网友答案:

You would not use a declaration block to set the values but rather set them in the controller with request.setAttribute(). Then:

<c:forEach var="ad" items="${Products}" begin="${i}" end="${j}">
相关阅读:
Top