?? buy.jsp
字號(hào):
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page session="true" %>
<%@ page import="bookshop.book.book" %>
<jsp:useBean id="book" scope="page" class="bookshop.run.op_book" />
<jsp:useBean id="shop" scope="page" class="bookshop.run.op_buy" />
<%
String mesg = "";
String submits = request.getParameter("Submit");
int Id=0;
if (submits!=null && !submits.equals("")){
if (shop.addnew(request)){
mesg = "你要的圖書已經(jīng)放入你的購(gòu)物車中!謝謝";
} else if (shop.getIsEmpty()){
mesg = "庫(kù)存圖書數(shù)量不足!只剩"+shop.getLeaveBook()+"本";
} else {
mesg = "暫時(shí)不能購(gòu)買!";
}
}else {
if (request.getParameter("bookid")==null || request.getParameter("bookid").equals("")) {
mesg = "你要購(gòu)買的圖書不存在!";
} else {
try {
Id = Integer.parseInt(request.getParameter("bookid"));
if (!book.getOnebook(Id)){
mesg = "你要購(gòu)買的圖書不存在!";
}
} catch (Exception e){
mesg = "你要購(gòu)買的圖書不存在!";
}
}
}
%>
<html>
<style type="text/css">
<!--
body {
background-color: #99CCFF;
}
-->
</style><head>
<title>零度書店在線 購(gòu)買圖書</title>
<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 check()
{
if (document.form1.amount.value<1){
alert("你的購(gòu)買數(shù)量有問(wèn)題");
document.form1.amount.focus();
return false;
}
return true;
}
</script>
<link rel="stylesheet" href="books.css" type="text/css">
</head>
<body text="#000000" onLoad="javascript:window.focus();">
<div align="center">
<p>零度書店歡迎你<font color="#CC0066">選購(gòu)圖書</font>!</p>
<% if(!mesg.equals("")){
out.println(mesg);
} else {
book bk = (book) book.getBooklist().elementAt(0);
%>
<table width="90%" border="0" cellspacing="2" cellpadding="1">
<form name="form1" method="post" action="buy.jsp">
<tr>
<td align="center">圖書名:<%= bk.getBookName() %></td>
</tr>
<tr align="center">
<td>你想要的數(shù)量:
<input type="text" name="amount" maxlength="4" size="3" value="1"> 本</td>
</tr>
<tr align="center">
<td>
<input type="hidden" name="bookid" value="<%=Id %>">
<input type="submit" name="Submit" value="購(gòu) 買" onClick="return(check());">
<input type="reset" name="Reset" value="取 消">
</td>
</tr>
<tr align="center">
<td><a href="#" onClick="openScript('detail.jsp?bookid=<%= Id %>','show',400,450)" >查看詳細(xì)資料</a> </td>
</tr>
</form>
</table>
<% } %>
<br>
<p><a href="javascript:window.close()">關(guān)閉窗口</a></p>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center">零度書店在線<br>
CopyRight@2007 陜西理工學(xué)院<br>
Email:<a href="mailto:shilei82@126.com">shilei82@126.com</a></td>
</tr>
</table>
</div>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -