Sunday, 15 September 2013

How to update bunch of products using a single form?

How to update bunch of products using a single form?

I have two questions first question is that, when I use $ jsp shows the
required variable but when I use % it does not which is weird. The other
question is that how can I update a bunch of products, in following
example I have a table which shows different products user should be able
to edit the values and click on a single submit button to update all the
values that have been changed for each product.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<table border="1">
<tbody>
<form id="" action="edit">
<c:forEach var="products" items="${listOfProducts}">
<tr>
<td>${products.id}</td>
<td>${products.name}</td> <<shows the name of
product but the
following does not
<td><s:textfield name="Name"
value="%{products.name}"/></td>
<td>${products.price}</td>
</tr>
</c:forEach>
</form>
</tbody>
</table>
Output
1 Pro1 23
3 Pro3 45
As shown the third column is empty

No comments:

Post a Comment