📄 spss.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*"%>
<%
try{
//数据库连接
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:zhuce";
Connection con=DriverManager.getConnection(url,"","");
Statement st=con.createStatement();
//得到用户传入的商品信息
String strName = request.getParameter("product_name");
String strClass = request.getParameter("product_class");
String sql = "select * from shop";
StringBuffer sb = new StringBuffer(sql);
if (strName.length() >0){
sb.append(" Where product_class like '%");
sb.append(strClass);
sb.append("%'");
}else{
sb.append(" Where product_class like '%%'");
}
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"><%=rs.getDouble("product_no")%>详细资料</td>
<td width="15%" align="center" height="28" bgcolor="#EEEEEE"><a href='gomai.jsp'><img src="image/mybuy.gif" width="64" height="16" border="0" align="absMiddle" style="CURSOR: hand"></a></td>
</tr>
<%
}
%>
</table>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<%
}catch(Exception e){
//错误处理
throw (e);
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -