Reputation: 8197
In the below code i am iterating a list from the servlet in my JSP page. It works fine, but i need to set the value ${product.reqid}
to the inout field . So that i would post the data with my form .
<c:forEach var="product" items="${myArrayList}">
<tr>
<td><c:out value="${product.reqid}"></c:out></td>
<td><c:out value="${product.proid}"></c:out></td>
<td><c:out value="${product.proname}"></c:out></td>
<td><c:out value="${product.username}"></c:out></td>
<input type ="hidden" name="reqno" value="${product.reqid}">
<td><input type="submit" value="Approve"></td>
</tr>
</c:forEach>
From the code i tried it prints NULL , when i try to print the value in the servlet. Thanks in advance
Upvotes: 0
Views: 130
Reputation: 9639
use the same technique as you did in the first column of the row
<c:forEach var="product" items="${myArrayList}">
<tr>
<td><c:out value="${product.reqid}"></c:out></td>
<td><c:out value="${product.proid}"></c:out></td>
<td><c:out value="${product.proname}"></c:out></td>
<td><c:out value="${product.username}"></c:out></td>
<input type ="hidden" name="reqno" value="<c:out value="${product.reqid}"/>">
<td><input type="submit" value="Approve"></td>
</tr>
</c:forEach>
Upvotes: 1