<%@ page session="true" import="java.util.List, br.com.senacagil.shoppingcart.CD" %>
<%
  List<CD> buyList = (List<CD>)session.getAttribute("shopping.shoppingcart");
  if (buyList != null && (buyList.size() >0)) {
%>
  <center>
  <table border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
    <tr>
      <td><b>ALBUM</b></td>
      <td><b>ARTIST</b></td>
      <td><b>COUNTRY</b></td>
      <td><b>PRICE</b></td>
      <td><b>QUANTITY</b></td>
      <td></td>
    </tr>
    <%
      int index=0;
      for ( CD anOrder: buyList ) {
    %>
    <tr>
      <td><b><%= anOrder.getAlbum() %></b></td>
      <td><b><%= anOrder.getArtist() %></b></td>
      <td><b><%= anOrder.getCountry() %></b></td>
      <td><b><%= anOrder.getPrice() %></b></td>
      <td><b><%= anOrder.getQuantity() %></b></td>
      <td>
        <form name="deleteForm"
              action="/examples/servlet/ShoppingServlet"
              method="POST">
          <input type="submit" value="Delete">
          <input type="hidden" name= "delindex" value='<%= index++ %>'>
          <input type="hidden" name="action"
           value="DELETE">
         </form> 
      </td>
    </tr> 
    <% } %>
  </table>
  <p>
  <form name="checkoutForm"
    action="/examples/servlet/ShoppingServlet"
    method="POST">
    <input type="hidden" name="action" value="CHECKOUT">
    <input type="submit" name="Checkout" value="Checkout">
  </form>
  </center>
<% } %>

