<%@ page import="java.util.List"%> <%@ page import="java.util.Iterator"%> <%@ page import="org.apache.geronimo.samples.computer.dto.ItemDTO"%> Add Item to Cart

Add Item to Cart

Please select quantity of items you are going to buy. If the quantity of buying is greater than or equal to the Discount Quantity, then you will get the given Discount Percentage of discount from each item of buying.

<% int discountQty = 0; double discount = 0.0; String itemDesc = null; String itemId = request.getParameter("itemId"); List itemList = (List)session.getAttribute("itemList"); for(Iterator iterator = itemList.iterator();iterator.hasNext();){ ItemDTO item = (ItemDTO)iterator.next(); if(Integer.parseInt(itemId) == item.getItemId()){ discountQty = item.getMinimumDiscountPurchase(); discount = item.getDiscountPercentage(); itemDesc = item.getDescription(); break; } } %>
Item Description: <%=itemDesc%>
Discount Quantity: <%=discountQty%>
Discount Percentage: <%=discount*100%>%
Quantity: