I have an element inside a list which i populate with jstl. the problem i have is that i a have a button with a form inside each loop. when a user clicks i need to know what object he has selected. any tips would be awesome.
<c:forEach items="${productos}" var="producto">
<li class="media ">
<a class="pull-left " href="verinfoproducto">
<img class="media-object" src="${producto.imagen}" height="128 " width="128"></a>
<div class="media-body ">
<h4 class="media-heading ">${producto.nombreP}</h4>
<p>${producto.descripcion}</p>
<h4>Precio: ${producto.precio}</h4>
<div class="row">
<c:choose>
<c:when test="${not empty sessionScope.cliente }" >
<form method="post" action="generarpedido">
<c:set var="productoSel" value="${producto}" scope="session"/>
<div class="col-md-2">
<input type="text" name="cantidad" class="form-control text-center" placeholder="Cantidad">
</div>
<div class="col-md-1">
<button type="submit">
<i class="fa fa-2x fa-cart-plus"></i></button>
</div>
</form>
</c:when>
</c:choose>
</div>
</div>
</li>
</c:forEach>