📄 shoperlist.jsp
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.util.*"%>
<%@ page import="com.bookshop.bean.BookClass"%>
<%@ page session="true"%>
<%@ page import="com.bookshop.bean.Books"%>
<%@ page import="com.bookshop.dao.Booksmn"%>
<%@ page import="com.bookshop.bean.IndentList"%>
<jsp:useBean id="book_list" scope="page" class="com.bookshop.dao.Booksmn" />
<jsp:useBean id="classlist" scope="page"
class="com.bookshop.dao.BookclassList" />
<jsp:useBean id="shop" scope="page" class="com.bookshop.dao.Purchase" />
<%
String userid = (String) session.getAttribute("userid");
if (userid == null)
userid = "";
String modi = request.getParameter("modi");
String del = request.getParameter("del");
String payoutCar = request.getParameter("payout");
String clearCar = request.getParameter("clear");
String mesg = "";
if (modi != null && !modi.equals(""))
{
if (!shop.modiShoper(request))
{
if (shop.getIsEmpty())
mesg = "你要的修改购买的图书数量不足你的购买数量!";
else
mesg = "修改购买数量出错!";
} else
{
mesg = "修改成功";
}
} else if (del != null && !del.equals(""))
{
if (!shop.delShoper(request))
{
mesg = "删除清单中的图书时出错!";
}
} else if (payoutCar != null && !payoutCar.equals(""))
{
if (shop.payout(request))
{
mesg = "你的购物车中的物品已提交给本店,你的订单号为 " + shop.getIndentNo()
+ "<br>请及时付款,以便我们发货!";
session.removeAttribute("shopcar");
} else
{
if (!shop.getIsLogin())
mesg = "你还没有登录,请先<a href=login.jsp>登录</a>后再提交";
else
mesg = "对不起,提交出错,请稍后重试";
}
} else if (clearCar != null && !clearCar.equals(""))
{
session.removeAttribute("shopcar");
mesg = "购物车中的物品清单已清空";
}
%>
<html>
<head>
<title>51网络电子书店--我的购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>a{TEXT-DECORATION:none}a:hover{TEXT-DECORATION:underline}</style>
<script language="JavaScript">
setInterval("a.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script>
<style type="text/css">
<!--
.style2 {color: #000000}
.style14 {color: #3366FF}
.style16 {font-size: 18px; color: #3366FF;}
-->
</style>
<script language="javascript">
function openScript(url,name, width, height){
var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function checklogin() {
if (document.payout.userid.value=="")
{
alert("你还没有登录,请登录后再提交购物清单地。");
return false;
}
return true;
}
function check()
{
if (document.change.amount.value<1){
alert("你的购买数量有问题");
document.change.amount.focus();
return false;
}
return true;
}
</script>
<link rel="stylesheet" href="books.css" type="text/css">
</head>
<body text="#000000">
<div align="center">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><img src="images/title.jpg" width="750" height="100"></td>
</tr>
</table>
<table width="750" border="0" cellspacing="1" cellpadding="1" >
<tr>
<td width="100" height="30" align="center" background="images/qntj.jpg"><a href="index.jsp" class="style14">首页</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="booklist.jsp" class="style14">在线购物</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="shoperlist.jsp" class="style14">我的购物车</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="login.jsp" class="style14">用户登录</a></td>
<td width="100" align="center" background="images/qntj.jpg"><a href="manage/login.jsp" class="style14">网站管理</a></td>
<td width="250" align="center" background="images/qntj.jpg"><div id="a"><span class="style7"></span></div></td>
</tr>
</table>
<table width="750" height="414" border="0" cellpadding="0" cellspacing="0" bordercolor="#33CCFF">
<tr valign="top">
<td width="150" height="412">
<table width="150" class="style17" height="74" border="0" cellpadding="1" cellspacing="1" align="center">
<tr align="center">
<td width="123" height="44" background="images/qntj.jpg" align="center">
<span class="style16">本店图书分类</span>
</td>
</tr>
<%
if (classlist.excute())
{
for (int i = 0; i < classlist.getClasslist().size(); i++)
{
BookClass bc = (BookClass) classlist.getClasslist().elementAt(i);
%>
<tr>
<td height="27" align="center" background="images/qntj.jpg">
<a href="booklist.jsp?classid=<%=bc.getId()%>"><%=bc.getClassName()%>
</a>
</td>
</tr>
<%
}
}
%>
</table>
<p>
</p>
<p>
</p>
</td>
<td align="center">
<p>
<br>
<b><font color="#0000FF">我的购物车物品清单</font> </b>
</p>
<%
if (!mesg.equals(""))
out.println("<p ><font color=#ff0000>" + mesg + "</font></p>");
Vector shoplist = (Vector) session.getAttribute("shopcar");
if (shoplist == null || shoplist.size() < 0)
{
if (mesg.equals(""))
out
.println("<p><font color=#ff0000>你还没有选择购买图书!请先购买</font></p>");
} else
{
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0"
bordercolor="#00CCFe">
<tr align="center">
<td height="58">
图书名称
</td>
<td>
作者
</td>
<td>
图书类别
</td>
<td>
单价(元)
</td>
<td>
数量
</td>
<td colspan=2>
选择
</td>
</tr>
<%
float totalprice = 0;
int totalamount = 0;
for (int i = 0; i < shoplist.size(); i++)
{
IndentList iList = (IndentList) shoplist.elementAt(i);
if (book_list.getOnebook((int) iList.getBookNo()))
{
Books bk = (Books) book_list.getBooklist().elementAt(0);
totalprice = totalprice + bk.getPrince()
* iList.getAmount();
totalamount = totalamount + iList.getAmount();
%>
<tr>
<td>
<%=bk.getBookName()%>
</td>
<td align="center">
<%=bk.getAuthor()%>
</td>
<td align="center">
<%=bk.getClassname()%>
</td>
<td align="center">
<%=bk.getPrince()%>
</td>
<form name="change" method="post" action="shoperlist.jsp">
<td align="center">
<input type="text" name="amount" maxlength="4" size="3"
value="<%=iList.getAmount()%>">
</td>
<td align="center" width=55>
<input type="hidden" name="bookid"
value="<%=iList.getBookNo()%>">
<input type="submit" name="modi" value="修改"
onclick="return(check());">
</td>
<form name="del" method="post" action="shoperlist.jsp">
<input type="hidden" name="bookid"
value="<%=iList.getBookNo()%>">
<td align=center width=55>
<input type="submit" name="del" value="删除">
</td>
<td height="49"></tr>
<%
}
}
%>
<tr>
<td colspan=7 align="right">
<br>
你选择的图书的总金额:
<%=totalprice%>
元 总数量:
<%=totalamount%>
本
</td>
</tr>
</table>
<p></p>
<table width="90%" border="0" cellspacing="1" cellpadding="1">
<tr>
<form name="payout" method="post" action="shoperlist.jsp">
<td align="right" valign="bottom">
<a href="booklist.jsp">继续购书</a>
<input type="hidden" name="userid" value="<%=userid%>">
<input type="hidden" name="totalprice" value="<%=totalprice%>">
<TEXTAREA NAME="content" ROWS="3" COLS="20">附言:</TEXTAREA>
<br>
<input type="submit" name="payout" value="提交我的购物车"
onclick="javascript:return(checklogin());">
</td>
<form name="form1" method="post" action="shoperlist.jsp">
<td valign="bottom">
<input type="submit" name="clear" value="清空我的购物车">
</td>
<td height="31"></tr>
</table>
<%
}
%>
</td>
</tr>
</table>
<hr width="750" color="#00CCFe"/>
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" >
<div align="center" class="style11">06计算机科学与技术3班
<br>
CopyRight@2009
<br>
E-mail:
<a href="mailto:dengxianghai2005@163.com">Jinlf112@163.com</a>
</div></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -