collection.jsp
上传用户:yatiankong
上传日期:2014-05-16
资源大小:5604k
文件大小:4k
源码类别:

Applet

开发平台:

Java

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.Iterator" errorPage="" %>
  3. <jsp:useBean id="book" scope="page" class="MyFly.Book.bookmn" />
  4. <jsp:useBean id="bookCollect" scope="page" class="MyFly.Book.bookCollect" />
  5. <jsp:useBean id="bookCollects" scope="page" class="MyFly.Book.bookCollects" />
  6. <%@ page import="MyFly.Book.Books" %>
  7. <script language="javascript">
  8. function openScript(url,name, width, height){
  9. var Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
  10. }
  11. </script>
  12. <HTML>
  13. <HEAD>
  14. <TITLE>-收藏箱-</TITLE>
  15. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  16. <META content=index,follow name=Robots>
  17. <LINK href="../image/buyok_shop.css" type=text/css rel=stylesheet>
  18. <META content="MSHTML 6.00.2900.3086" name=GENERATOR></HEAD>
  19. <BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 >
  20. <% 
  21. String mesg="";
  22. String bookid=request.getParameter("bookid");
  23. String userid = (String) session.getAttribute("userid");
  24. if(userid==null)
  25. {
  26.    out.println("<Script language=JavaScript>alert('您还没登录,您无权收藏');javascript:window.close();</Script>");
  27. else 
  28. {
  29. if (!book.getOnebook(bookid)){
  30. mesg = "你要购买的图书不存在!";
  31. out.println("<Script language=JavaScript>alert('"+mesg+"');javascript:history.back();</Script>");
  32. }
  33. else
  34. {
  35. Books bk = (Books) book.getBooklist().elementAt(0);
  36. bookCollect.setUserid(userid);
  37. bookCollect.setBookid(bk.getProductID());
  38. bookCollect.setBookname(bk.getProductName());
  39. %>
  40. <TABLE cellSpacing=0 cellPadding=0 width=630 align=center border=0>
  41.   <TBODY>
  42.   <TR>
  43.     <TD height=50><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT 
  44.       color=#ff3333><B>您选择的图书已经放入收藏箱,收藏箱中的图书将永久保存,除非您主动删除。</B></FONT><BR></TD></TR>
  45.   <TR>
  46.     <TD>
  47.       <TABLE cellSpacing=1 cellPadding=4 width=567 align=center bgColor=#cccccc 
  48.       border=0>
  49.         <FORM name=check action=collupdate.jsp method=post>
  50.         
  51.         <TR bgColor=#ffffff>
  52.           <TD align="center" width=60 height=25><FONT color=#b0266d>选择</FONT></TD>
  53.           <TD align="center" width=120><FONT color=#b0266d>商 品 编 号</FONT></TD>
  54.           <TD align="center" width=340><FONT color=#b0266d>商 品 名 称</FONT></TD>
  55.           <TD align="center" width=170><FONT color=#b0266d>购 买</FONT></TD></TR>
  56.   <%
  57.   if(bookCollect.setBookCollect()==1)
  58. {
  59.    out.println("<Script language=JavaScript>alert('您已经收藏过此图书');javascript:window.close();</Script>");
  60. }
  61. else{
  62. bookCollects.setUserno(userid);
  63. bookCollects.getQueryBook();
  64. int item=bookCollects.getItems();
  65. System.out.print(item);
  66. for(int i=0; i<item; i++)
  67. {
  68.   %>
  69.         <TR bgColor=#ffffff>
  70.           <TD align="center"height=20><INPUT type=checkbox CHECKED 
  71.             value="<%= bookCollects.getBookid(i)%>" name=ProdId></TD>
  72.           <TD align="center"><%= bookCollects.getBookid(i)%> </TD>
  73.           <TD>&nbsp;&nbsp;<FONT color=#b0266d><%= bookCollects.getBookname(i) %></FONT></TD>
  74.           <TD align="center"><A href="#" onClick="openScript('../purchasecart.jsp?bookid=<%= bookCollects.getBookid(i)%>','pur',650,300)">放入购物车</A></TD></TR>
  75.   <%}}%>
  76.         <TR>
  77.           <TD bgColor=#ffffff colSpan=4 height=40><FONT 
  78.             color=red>注意:若要删除收藏箱中的图书,请去掉图书前的小勾,再单击“更新收藏”。</FONT> </TD></TR>
  79.         <TR bgColor=#ffffff>
  80.           <TD vAlign="middle" align="center" colSpan=4 height=40>
  81.   <INPUT type=submit value=更新收藏箱 name=fav> 
  82.             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  83.           <INPUT  onclick=javascript:window.close() type=button value="继续购物" name=button> 
  84.           
  85.   </TD></TR></FORM></TABLE></TD></TR></TBODY></TABLE>
  86.   <%}
  87.   }%>
  88.   
  89.   </BODY></HTML>