basket.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:6k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <html>
  3. <head>
  4. <link href=css.css rel=STYLESHEET type=text/css>
  5. <jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>
  6. <title>
  7. <%!
  8.  int Cint(String cint)
  9.    {
  10.     try {
  11.   int n;
  12.       n= Integer.parseInt(cint);
  13.   return n;
  14.         }
  15.        catch (NumberFormatException e) {
  16.                  return 0;
  17.         }
  18. }
  19. %>
  20. <%!
  21.  String getStr(String str)
  22. {
  23.   try
  24. {
  25. String temp_p=str;
  26. byte[] temp_t=temp_p.getBytes("ISO8859-1");
  27. String temp=new String(temp_t);
  28. return temp;
  29. }
  30. catch(Exception e)
  31. {
  32. e.printStackTrace();
  33. return null;
  34.  }
  35. }
  36. %>
  37. <%
  38. String user_name=(String)session.getValue("user_name");
  39.       
  40. String user_type=(String)session.getValue("user_type");
  41.        
  42. if(user_name!=null)
  43. {
  44. %>
  45. <%=user_name%>的购物车
  46. <%
  47. }else
  48. {
  49. out.print("购物车");
  50. }%>
  51. </title></head>
  52. <body><font color="#000000"><b>
  53. <%
  54. String hw_cashs,basket_count,sql,hw_name;
  55. int hw_cash,jiage,count,totalcash=0;
  56. if(user_name==null) 
  57. {
  58.     out.print( "1.你尚未登录!请登录后再订购本站商品!");
  59.     out.print("<br>2.第一次来本站,请先注册会员(免费)!");
  60. %>
  61. <a href=# onClick="javascript:window.close();">关闭窗口</a>
  62. <%
  63. }
  64. else
  65. {//having  login check
  66.     int hw_id;
  67. String hw_ids=request.getParameter("hw_id");
  68.      if(hw_ids==null)
  69.         {
  70.  out.print("没有此货物");
  71.         }
  72.    else
  73.   {//hw_id exists or not--------------------------------------------------------------
  74.          
  75.  hw_ids.trim();
  76.  ResultSet rs;
  77.   int daili;
  78.   hw_id=Cint(hw_ids);
  79.          sql="select * from hw where hw_id="+hw_id;
  80.          rs=mdb.executeQuery(sql);
  81.  if(rs.next())
  82.   {   
  83.   //result showing begin ------------------------------------------
  84.     hw_cash=rs.getInt("hw_cash");
  85.     daili=rs.getInt("daili");
  86.     hw_name=rs.getString("hw_name");
  87.     %>
  88. <br>
  89. <table border="0" width="400" cellspacing="0" cellpadding="0">
  90.   <tr> 
  91.     <td align="center" bgcolor="#DBC2B0"><font color="#000000"><b>
  92.     <img border="0" src="img/promo_list_top.gif" width="100%" height="4"></td></tr>
  93.   <tr> 
  94.     <td height="18" align="center" bgcolor="#DBC2B0">所选购的商品信息</td></tr><tr> 
  95.     <td height="16"> <form method="POST" action="buy.jsp?action=buy&hw_id=<%=hw_id%>&hw_name=<%=hw_name%>&hw_cash=<%
  96. if(user_type.equals("会员"))
  97. {
  98. out.print(hw_cash);
  99. }else
  100. {out.print(daili);
  101. }%>">
  102.         <table border="0" width="100%" cellspacing="0" height="34" cellpadding="0">
  103.           <tr bgcolor="#FFFFFF"> 
  104.             <td width="398" bgcolor="#F5EFE7">
  105.             <div align="center">
  106.               <center>
  107.               <table width="90%" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
  108.                 <tr background="img/pics/tile_bg.gif"> 
  109.                   <td width="155" height="25"> <div align="center">商品名称</div></td>
  110.                   <td width="60" height="25"> <div align="center">商品单价</div></td>
  111.                   <td width="60" height="25"> <div align="center">订购数量</div></td>
  112.                   <td width="80" height="25"> <div align="center">确认购买</div></td>
  113.                 </tr>
  114.                 <tr> 
  115.                   <td width="155" height="30"> <div align="center"><%=hw_name%></div></td>
  116.                   <td width="60" height="30"> <div align="center"> 
  117.                       <%if(user_type=="会员")
  118.   {%>
  119.                       <%=hw_cash%> 
  120.                       <%
  121.   }else
  122.   {%>
  123.                       <%=daili%> 
  124.                       <%}
  125.   %>
  126.                       元</div></td>
  127.                   <td width="60" height="30"> <div align="center"> 
  128.                       <select size="1" name="count">
  129.                         <%for(int i=0;i<=10;i++){
  130. %>
  131.                         <option><%=i%></option>
  132.                         <%}
  133. %>
  134.                       </select>
  135.                     </div></td>
  136.                   <td width="80" height="30"> <div align="center"> 
  137.                           <input name=B1 type=image id="B1" 
  138.       src="img/pics/ok.gif" alt=投诉 
  139.       align=absMiddle width="45" height="20" cache tppabs="">
  140.                         </div></td>
  141.                 </tr>
  142.               </table>
  143.               </center>
  144.             </div></tr>
  145.         </table>
  146.       </form></td>
  147.   </tr>
  148.   <tr> 
  149.     <td height="30" valign="top" bgcolor="#F5EFE7"><table width="83%" border="0" align="center" cellpadding="0" cellspacing="0">
  150.         <tr> 
  151.           <td width="33%"><a href="buy.jsp"><img src="img/pics/lookbcar.gif" width="100" height="20" border="0"></a></td>
  152.           <td width="33%"><a href="clear.jsp"><img src="img/pics/relbcar.gif" width="100" height="20" border="0"></a></td>
  153.           <td width="33%"><a href="cash.jsp"><img src="img/pics/gobuy.gif" width="100" height="20" border="0"></a></td>
  154.         </tr>
  155.       </table></td>
  156.   </tr>
  157.   <tr> 
  158.     <td align="center">
  159.     <img border="0" src="img/promo_list_top.gif" width="100%" height="4"></td>
  160.   </tr>
  161.   <tr> 
  162.     <td height="18" align="center" bgcolor="#DBC2B0">你已选购的商品如下</td>
  163.   </tr>
  164.   <!----------------------------things bought------------------------------------>
  165.   <%@ include file="bought.jsp"%>
  166. <!----------------------------things bought end ------------------------------------>
  167. </table>
  168. <%          }//result showing end ------------------------------------------
  169.     rs.close();
  170. mdb.Close();
  171.        }//hw_id exist check end------------------------------------------------------------
  172. }//login or not check end
  173. %>