protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session=request.getSession(true);
String[][] goods=(String[][])session.getAttribute("MYCART");
if(goods==null) {
}
float total=0;
for(int i=0;i<goods.length;i++) {
float amount=Float.parseFloat(goods[i][2])*Integer.parseInt(goods[i][3]);
if(amount==0)
continue;
total += amount;
}
double discount=1;
if(total >=1000)
discount=0.85;
else if(total >=500)
discount=0.9;
else if(total >=200)
discount=0.95;
else if(total >=100)
discount=0.98;
String url="191220117-cart.jsp?DISCOUNT="+discount+"&TOTAL"+total;
RequestDispatcher rd=request.getRequestDispatcher(url);
rd.forward(request, response);
}
public void init() throws ServletException{
}
}