接受页面:
<%@ page language="java" contentType="text/html;" pageEncoding="8859_1"%>
<%@ page import="java.io.*,java.util.*" %>
<%@ page import="myProductions.myProductionsBean" %>
<%
Vector buylist = (Vector)session.getAttribute("shoppingcart");
     String action = request.getParameter("action");
             //  删除购物车中的书籍
if (action.equals("DELETE"))
     {
        String del = request.getParameter("del");
        int d = (new Integer(del)).intValue();
        buylist.removeElementAt(d);
     }
    
     // 新增书籍至购物车中
     else if (action.equals("ADD"))
     {               boolean match=false;
%>

    <jsp:useBean id="newProductions" scope="request" class="myProductions.myProductionsBean" />
<jsp:setProperty name="newProductions" property="*"/> <jsp:getProperty name="newProductions" property="name"/>
<jsp:getProperty name="newProductions" property="id"/>
<jsp:getProperty name="newProductions" property="price"/>
<jsp:getProperty name="newProductions" property="quantity"/>

<%
        // 新增第一本书籍至购物车时
        if (buylist == null)
        {
        buylist = new Vector();
        buylist.addElement(newProductions);
        }
        else 
{
        for (int i=0; i< buylist.size(); i++)
        {
            myProductionsBean prod = (myProductionsBean)buylist.elementAt(i);           // 假若新增的书籍和购物车的书籍一样时
            if (prod.getName().equals(newProductions.getName()))
            {
            prod.setQuantity(prod.getQuantity()+newProductions.getQuantity());
            buylist.setElementAt(prod,i);
            match = true;
            } //end of if name matches
        } // end of for        // 假若新增的书籍和购物车的书籍不一样时
        if (!match)
            buylist.addElement(newProductions);
        }
}

     session.setAttribute("shoppingcart", buylist);
    
if (buylist != null && (buylist.size() > 0)) 
{
%>
<html>
<head>
  <title>Store---我的购物车</title>
</head>
<body><h2>目前您购物车的内容如下:</h2><table border="1" width="631">
  <tr bgcolor="#999999"> 
    <td width="194"><div align="center"><b>ID</b></div></td> 
    <td width="194"><div align="center"><b>商品名称</b></div></td>    
    <td width="57"><div align="center"><b>价格</b></div></td>
    <td width="47"><div align="center"><b>数量</b></div></td>
    <td width="119"><div align="center"><b></b></div></td>
  </tr>
<%
for (int index=0; index < buylist.size();index++) 
{
     myProductionsBean order = (myProductionsBean)buylist.elementAt(index);
%>
 <tr>
  <td><b><%= order.getId() %></b></td>  
  <td><b><%= order.getName() %></b></td>  
  <td><b><div align="right"><%= order.getPrice() %></div></b></td>
  <td><b><div align="right"><%= order.getQuantity() %></div></b></td>
  <td>
  <form name="deleteForm" action="Store.jsp" method="POST">
   <input type="submit" value="Delete">
   <input type="hidden" name= "del" value='<%= index %>'>
   <input type="hidden" name="action" value="DELETE">
  </form> 
      </td>
    </tr> 
<% 
}
%>
</table>
<p>
  <a href="mypselect.jsp">继续购物</a>
  <form name="checkoutForm" action="Checkout.jsp" method="POST">
    <input type="hidden" name="action" value="CHECKOUT">
    <input type="submit" name="Checkout" value="付款结账">
  </form>
<% 
}
else
{
%>
<h2>目前您的购物车没有任何物品:</h2><br>
<a href="mypselect.jsp">继续购物</a>
<%
}
%>
</body>
</html>