📄 shoppingcart.jsp
字号:
<%@page contentType="text/html;charset=gb2312" %>
<%@page import="cn.com.s251.team1.movieshow.vo.*" %>
<%@page import="java.util.*,java.lang.*" %>
<html>
<head>
<title>购物车</title>
<style type="text/css">
.book
{
font-size:12px;
}
</style>
</head>
<jsp:useBean id="cart" scope="session" class="cn.com.s251.team1.movieshow.vo.ShoppingCart" />
<%
request.setCharacterEncoding("GBK");
String id = request.getParameter("id");
if(id!=null)
{
String action = request.getParameter("action");
if("删除".equals(action))
{
cart.removemovie(id);
}
else if("更新".equals(action))
{
cart.setAmount(id, request.getParameter("amount"));
}
else
{
cart.addmovie(id);
}
}
Object[][] items = cart.getItems();
%>
<body bgcolor="#ffffff">
<%@include file="head.jsp" %>
<table width="750px" align="center">
<tr>
<td width="100%" bgcolor="#1234AB"><font color="white"><b>购物车</b></font></td>
</tr>
</table>
<p>
<table width="750px" cellpadding="5" class="book" border="1" align="center">
<tr>
<th>标题</th>
<th>单价</th>
<th>数量</th>
<th>小计</th>
<th> </th>
</tr>
<%
for(int i=0; i<items.length; i++){
%>
<tr>
<form action="" method="POST">
<input type="hidden" name="id" value="<%=items[i][0]%>"/>
<td><%=items[i][1] %></td>
<td><%=WebUtil.formatMoney(items[i][2]) %></td>
<td><input size="3" maxlength="3" name="amount" value="<%=items[i][3] %>"/></td>
<td><%=WebUtil.formatMoney(items[i][4]) %></td>
<td><input type="submit" value="更新" name="action"/><input type="submit" value="删除" name="action"/></td>
</form>
</tr>
<%
}
%>
</table>
<p>
<table width="750px" align="center">
<tr>
<td>
<a class="book" href="index.jsp">继续购物</a>
<a class="book" href="roderList.jsp">提交订单</a>
</td>
</tr>
</table>
<%@include file="bottom.jsp" %>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -