spjj.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:6k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@ page import="java.sql.*"%>
  3. <%
  4.   try{
  5.   //数据库连接
  6.   Class.forName("oracle.jdbc.driver.OracleDriver");
  7.   String strUrl = "jdbc:oracle:thin:@slight:1521:LOCAL";
  8.   String strUser = "eshop";
  9.   String strPassword = "eshop";
  10.   Connection con = DriverManager.getConnection(strUrl, strUser, strPassword);
  11.   Statement st = con.createStatement();
  12.   //得到商品号
  13.   long longNum = Long.parseLong(request.getParameter("ProductNO"));
  14.   //更改商品点击次数
  15.   String sql = "update Product set look_count = look_count+1 where product_no ="
  16.             + longNum;
  17.   System.out.println(sql);
  18.   st.executeUpdate(sql);
  19.   sql = "select * from Product where product_no =" + longNum;
  20.   ResultSet rs = st.executeQuery(sql);
  21.   if (rs.next()){
  22. %>
  23. <html>
  24. <head>
  25. <title>
  26. 商品简介
  27. </title>
  28. <script>
  29.   function openbag(id) { window.open("eshop.asp?cpbm="+id,"","height=400,width=630,left=200,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");}
  30. </script>
  31. <link rel="stylesheet" type="text/css" href="style.css">
  32. </head>
  33. <body leftmargin="0">
  34.   <div align="center">
  35.     <center>
  36.       <table width="580" border="0" cellSpacing="1" bgcolor="#336699">
  37.         <tbody>
  38.           <tr align="left" bgColor="#eeeeee">
  39.             <td class="bighead" bgColor="#336699" colSpan="5" height="24">&nbsp;<font class="105v" color="#ffffff">商品信息</font></td>
  40.           </tr>
  41.           <tr bgColor="#eeeeee">
  42.             <td colSpan="5" bgcolor="#336699">
  43.               <table border="0" cellpadding="10" cellspacing="0" width="100%" height="92" bgcolor="#FFFFFF">
  44.                 <tr>
  45.                   <td width="100%" height="22" valign="middle">&nbsp;<a href="index.jsp">首页</a>
  46.                      &gt;&gt;<a href="splb.jsp?spdl=<%=rs.getString("Class_1")%>&amp;spxl=<%=rs.getString("Class_2")%>"><%=rs.getString("Class_1")%> - <%=rs.getString("Class_2")%></a>&gt;&gt;
  47.                       <%=rs.getString("Product_Name")%>
  48.                       <hr size="1" color="#336699">
  49.                   </td>
  50.                 </tr>
  51.                 <tr>
  52.                   <td width="100%" height="70">
  53.                     <div align="center">
  54.                       <table border="0" cellpadding="2" cellspacing="0" width="100%" height="44">
  55.                         <tr>
  56.                           <td width="44%" height="22" align="center"><b>&nbsp;&nbsp;</b></td>
  57.                           <td width="56%" height="22" align="center"></td>
  58.                         </tr>
  59.                         <tr>
  60.                           <td width="44%" height="22" align="center"><img border="0" src="<%=rs.getString("P_Full_Pic")%>"></td>
  61.                           <td width="56%" height="33" align="center" rowspan="2">
  62.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><b>[商品名称]</b>:<%=rs.getString("Product_Name")%><p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><b>[市场价格]</b>:<strike><%=rs.getDouble("P_OldPrice")%>元</strike>
  63.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> 
  64.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><b>[会员价格]</b><font color="#FF0000">:<%=rs.getDouble("P_NewPrice")%>元&nbsp;&nbsp;
  65.                                 立即节省:<%=rs.getDouble("P_OldPrice")-rs.getDouble("P_NewPrice")%>元</font>
  66.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> 
  67.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0">
  68.                             <b>[商品简介]</b>:<%=rs.getString("Product_Intro")%></p>
  69.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  70.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><b>[商品说明]</b>:<%=rs.getString("Product_Show")%></p>
  71.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  72.                             <p align="left" style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><b>[支付方式]</b>:<a href="http://">请看详细说明!</a>
  73.                           </td>
  74.                         </tr>
  75.                         <tr>
  76.                           <td width="44%" height="58" align="center" valign="top"><br>
  77.                               [本图例仅供参考]
  78.                               <p>浏览次数:<%=rs.getLong("Look_Count")%>
  79.                               <p><a href="javascript:openbag(<%=rs.getString("Product_Id")%>)"><img border="0" src="images/mybuy.gif"></a>
  80.                           </td>
  81.                         </tr>
  82.                         <tr>
  83.                           <td width="100%" height="58" align="center" valign="top" colspan="2">
  84.                             <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> 
  85.                             <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> 
  86.                             <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0">如果你是第一次购物请看《购物指导》
  87.                           </td>
  88.                         </tr>
  89.                       </table>
  90.                   </td>
  91.                 </tr>
  92.             </table>
  93.         </td>
  94.       </tr>
  95.      </tbody>
  96.     </table>
  97.   </center>
  98.  </div>
  99.   <div align="center">
  100.     <center>
  101.        <table border="0" cellpadding="0" cellspacing="0" width="550" height="80">
  102.          <tr>
  103.             <td width="100%" height="62" valign="top"></td>
  104.         </tr>
  105.       </table>
  106.     </center>
  107.   </div>
  108. </body>
  109. </html>
  110. <%
  111.   }
  112.   }catch(Exception e){
  113.   //错误处理
  114.   throw (e);
  115.   }
  116. %>