CartActionForm cartForm = (CartActionForm) form;
Iterator cartItems = cartForm.getCart().getAllCartItems();
while (cartItems.hasNext()) {
CartItem cartItem = (CartItem) cartItems.next();
String itemId = cartItem.getItem().getItemId();
try {
int quantity = Integer.parseInt(request.getParameter(itemId));
cartForm.getCart().setQuantityByItemId(itemId, quantity);
if (quantity < 1) {
cartItems.remove();
}
}
catch (NumberFormatException e) {
//ignore on purpose
}
}
return mapping.findForward("success");