<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="GB2312"%>   
<%@ taglib prefix="s" uri="/struts-tags" %>  
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>查看购物车</title>
    <link href="./css/style.css" rel="stylesheet" type="text/css">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <style type="text/css">
  body {
	margin-left: 0px;
	margin-top: 0px;
	text-align: justify;
}
  </style>
  </head>
  
  <body>
  <table width="1224" border="0" align="center">
    <tr>
      <td width="220" height="95"><div align="center"><a href="./index.jsp"><img src="./images/logo.jpg" border="0"></a></div></td>
      <td width="842" height="100"><div align="center"><img src="./images/banner.jpg" width="468" height="80"></div></td>
      <td width="148" align="center"><img src="images/20080521140859838.gif" alt="" width="91" height="22"><br>
      <br>        <img src="images/20080521140855113.gif" alt="" width="77" height="18"></td>
    </tr>
    <tr>
      <td colspan="3"><s:action name="listMenu" executeResult="true"></s:action></td>
    </tr>
    <tr>
      <td align="center" valign="top"><table width="220" bgcolor=""><tr><td align="center">
    <s:set name="username" value="#session['username']" />
    <s:if test="#username==null">
    <table  height="100"><tr><td background="images/loginbg.jpg" align="center" rowspan="0" colspan="0">
      <b>会员登录</b>
      <s:form method="POST" action="./loginAction2!login">
      <s:textfield  name="user.username" label="用户名"/>
      <s:password  name="user.password"  label="密码"/>
      <s:submit value="登录" align="center"/> <s:reset value="重置" align="center"/>
	  </s:form>
     </td></tr> </table>
    </s:if>
    <s:else>
    <table align="center">
      <tr><td rowspan="0" colspan="0">
                欢迎您<s:property value="#session.username"/>！<br>
      <s:a href="cart/viewcart.jsp">查看购物车</s:a>
      <s:form action="./logoutAction!logout">
      <s:submit value="注销"></s:submit>
      </s:form>   
      </td></tr></table>
    </s:else> 
    </td></tr>
    <tr><td background="images/regbg.jpg"> <s:a href="user/adduser.jsp">
      <div align="center">注册用户</div>
    </s:a> 
      </td>
    </tr> </table>&nbsp;</td>
      <td colspan="2" align="center" valign="middle"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" bgColor="#c0c0c0">
  <tr>
  <td>
  <table cellspacing="1" cellpadding="0" border="0" width="100%">
  <tr bgcolor="#ffffff" >
<td width="62" align="center" background="./images/tablebg.jpg"><strong>产品编号</strong></td><td width="234" background="./images/tablebg.jpg"><strong> 产品名称</strong></td><td width="77" align="center" background="./images/tablebg.jpg"><strong> 价格</strong></td><td align="center" background="./images/tablebg.jpg"><strong> 数量</strong></td><td width="109" align="center" background="./images/tablebg.jpg"><strong>总价</strong></td><td width="76" align="center" background="./images/tablebg.jpg"><strong> 操作</strong></td>
</tr><s:set var="count" value="0"/> 
<s:iterator value="#session.shopcart" > 
<tr bgcolor="#ffffff">

<td align="center">
<s:property value="productid"/>
 <s:set var="productid" value="productid"/></td><td>
<s:property value="productname"/></td><td align="center">
 <font size="5"> &yen; </font><font color="red" size="4"> <s:property value="price"/></font> 元</td><td width="31">
<s:form method="POST" action="updateCart!update.action?productid=%{#productid}">  <s:set var="quantity" value="quantity"/><s:textfield  name="quantity"  value="%{#quantity}" size="2"/> <s:submit value="更改" /></s:form></td><td align="center">
<s:set var="cost" value="price*quantity"/>  <font size="5"> &yen; </font><font color="red" size="4"><s:property value="%{#cost}"/></font>元 </td><td align="center"><a href="deleteCart!delete?productid=<s:property value="productid"/>">删除</a></td></tr>
<s:set var="count" value="%{#count+#cost}"/>
</s:iterator> 
<tr bgcolor="#ffffff">
<td colspan="6" align="right"> 合计： <font size="5"> &yen; </font><font color="red" size="4"><s:property value="%{#count}"/></font>元</td></tr></table></td></tr></table>
        <br>
<s:a href="clearCart!clear"><img src="./images/20080521140900254.gif" width="115" height="36" border="0"></s:a> 
 <s:a href="productsAction!list"><img src="./images/20080521140900587.gif" width="115" height="36" border="0"></s:a> <s:a href="./order/order.jsp"><img src="./images/20080521140900511.gif" width="115" height="36" border="0"></s:a></td>
    </tr>
    <tr>
      <td colspan="3"><div align="center">Copyright&copy;2015信通购物网InfocomShop版权所有</div></td>
    </tr>
  </table>
  </body>
</html>
