spss.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:4k
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*"%>
- <%
- try{
- //数据库连接
- Class.forName("oracle.jdbc.driver.OracleDriver");
- String strUrl = "jdbc:oracle:thin:@slight:1521:LOCAL";
- String strUser = "eshop";
- String strPassword = "eshop";
- Connection con = DriverManager.getConnection(strUrl, strUser, strPassword);
- Statement st = con.createStatement();
- //得到用户传入的商品信息
- String strName = request.getParameter("Product_Name");
- strName = new String(strName.getBytes("iso8859-1"),"gb2312");
- String strClass = request.getParameter("Product_Class");
- strClass = new String(strClass.getBytes("iso8859-1"),"gb2312");
- String sql = "select * from Product";
- StringBuffer sb = new StringBuffer(sql);
- if (strName.length() >0){
- sb.append(" Where Product_Name like '%");
- sb.append(strName);
- sb.append("%'");
- }else{
- sb.append(" Where Product_Name like '%%'");
- }
- if (strClass.length()>0){
- sb.append(" AND Class_1 like '%");
- sb.append(strClass);
- sb.append("%'");
- }
- ResultSet rs = st.executeQuery(sb.toString());
- %>
- <html>
- <head>
- <title>
- 商品搜索
- </title>
- <script language="javascript">
- function openbag(id) { window.open("eshop.asp?cpbm="+id,"","height=200,width=700,left=190,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");}
- </script>
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- <body>
- <div align="center">
- <table border="0" cellpadding="0" cellspacing="0" width="600" height="92" >
- <tr>
- <td width="100%" height="70">
- <div align="center">
- <table border="0" cellpadding="0" cellspacing="0" width="100%" height="148" >
- <tr>
- <td valign="top">
- <div align="center">
- <table border="0" cellspacing="1" width="100%" bordercolorlight="#006699" bordercolordark="#FFFFFF" height="55" bgcolor="#000000">
- <tr>
- <td width="16%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">商品编号</font></td>
- <td width="34%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">商品名称</font></td>
- <td width="18%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">会员价</font></td>
- <td width="17%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">详细信息</font></td>
- <td width="15%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">购买</font></td>
- </tr>
- <%
- while (rs.next()){
- %>
- <tr>
- <td width="16%" align="center" height="28" bgcolor="#EEEEEE"><%=rs.getString("Product_Id")%></td>
- <td width="34%" align="center" height="28" bgcolor="#EEEEEE" ><%=rs.getString("Product_Name")%></td>
- <td width="18%" align="center" height="28" bgcolor="#EEEEEE"><%=rs.getDouble("P_NewPrice")%></td>
- <td width="17%" align="center" height="28" bgcolor="#EEEEEE"><a href="spjj.jsp?ProductNO=<%=rs.getLong("Product_No")%>">详细资料</td>
- <td width="15%" align="center" height="28" bgcolor="#EEEEEE"><a href='javascript:openbag(<%=rs.getString("Product_Id")%>)'><img style="CURSOR: hand" src="images/mybuy.gif" align="absMiddle" border="0"></a></td>
- </tr>
- <%
- }
- %>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </body>
- </html>
- <%
- }catch(Exception e){
- //错误处理
- throw (e);
- }
- %>