java - Passing data to servlet through button in jsp -
i have database products. when accept 1 of them want pass id servlet. accept or deny them using 2 buttons (accept, deny). how can pass id servlet?
don't forget there many products, let's 5 of them. how can sure id send servlet? here part of code:
<c:foreach var="product" items="${productlist}" > <div id="box"> <div id="box_info"> ${product.id}<br /> ${product.name}<br /> ${product.category}<br /> ${product.currently}<br /> ${product.currently}<br /> ${product.firstbid}<br /> ${product.numberofbids}<br /> ${product.location}<br /> ${product.country}<br /> ${product.description}<br /> </div> <div id="box_buttons"> <a href="myservlet1"><div id="box_button" class="accept">accept</div></a> <a href="myservlet2"><div id="box_button" class="deny">deny</div></a> </div> </div>
i changed <a href...>
submit buttons. cool now. here changes.
<c:foreach var="product" items="${productlist}" > <div id="box"> <div id="box_info"> ${product.id}<br /> ${product.name}<br /> ${product.category}<br /> ${product.currently}<br /> ${product.currently}<br /> ${product.firstbid}<br /> ${product.numberofbids}<br /> ${product.location}<br /> ${product.country}<br /> ${product.description}<br /> </div> <div id="box_buttons"> <form> <input type="hidden" name="product_id" value=${product.id} /> <input type="submit" value="deny" name="act" id="box_button" class="accept"> <input type="submit" value="accept" name="act" id="box_button" class="deny"> </form> </div> </div>