⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shoppinglist.jsp

📁 JSPshop JSPshop JSPshop
💻 JSP
字号:
<%@ page language="java" contentType="text/html;charset=gb2312" import="wssd.*,java.sql.*"%>
<jsp:useBean id="db" class="wssd.wssdDB" />
<html>
<head>
<title>购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<%
	String id = request.getParameter("id");

	if(id == null || id.length() == 0)
	{
		shopping list = (shopping)session.getAttribute("shoplist");
		if(list == null)
		{
			out.print("没有购物车信息");
		}
		else
		{
			for(int i=0; i<list.shoplist.size(); i++)
			{
				carTable ct = (carTable)list.shoplist.get(i);
				%>
				<table border="1" cellspacing="0" bordercolor="#000000">
				<tr>
				<td>商品名称:</td>
				<td><%=ct.getTitle()%></td>
				</tr>
				<tr>
				<td>商品价格:</td>
				<td><%=ct.getPrice()%></td>
				</tr>
				</table>
				<table>
				<tr>
				<td><input type="button" class="logbutton" value="删除" onclick="self.location.href='shoppinglist.jsp?id=<%=i%>&action=delete'"></td>
				<td>&nbsp;</td>
				</tr>
				</table>
				<%
			}
			list.setShopprice();
			%>
			<form method="post" action="orderDeal.jsp?action=submit">
			<table>
			<tr>
				<td>总价:</td>
				<td><%=list.getShoprice()%></td>
			</tr>
			<tr>
				<td>付款方式:</td>
				<td><select name="paystyle">
					<%
					for(int i=0; i<KeyWord.paystyle.length; i++)
					{
						%>
						<option value="<%=i%>"><%=KeyWord.paystyle[i]%></option>
						<%
					}
					%>
				</select></td>
			</tr>
			<tr>
			<td><input type="submit" class="logbutton" value="提交订单"></td>
			<td><input type="button" class="logbutton" value="关闭" onclick="window.close()"></td>
			</tr>
			</table>
			</form>
			<%
		}
	}
	else
	{
		String action = request.getParameter("action");
		if("add".equals(action))
		{
			carTable ct = db.getCarById(id);
			if(ct != null)
			{
				shopping list = (shopping)session.getAttribute("shoplist");
				list.shoplist.add(ct);
				session.setAttribute("shoplist",list);
				response.sendRedirect("shoppinglist.jsp");
			}
		}
		if("delete".equals(action))
		{
			shopping list = (shopping)session.getAttribute("shoplist");
			list.shoplist.remove(Integer.parseInt(id));
			session.setAttribute("shoplist",list);

			%>
			<script language="javascript">
				self.location.href="shoppinglist.jsp";
			</script>
			<%
		}
	}
%>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -