📄 chaxun.jsp
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ResultSet</title>
</head>
<body bgcolor="#ffdcdc" background="">
<%@page import="java.sql.*"%>
<%@page contentType="text/html;charset=gb2312"%>
<%
String name=new String(request.getParameter("select"));
String DBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
String ConnStr="jdbc:odbc:zhuce";
String temp1,temp2,temp3,temp4,temp5,temp6,temp7;
String sql="select * from shop where product_class like ";
try
{
Class.forName(DBDriver);
}
catch(java.lang.ClassNotFoundException e)
{
System.err.println("database:"+e.getMessage());
}
try
{
Connection conn=DriverManager.getConnection(ConnStr," "," ");
ResultSet rs;
Statement stmt=conn.createStatement();
rs=stmt.executeQuery(sql+"'"+name+"'");
out.print("查询结果如下:"+"<table border>"+"<tr>"+"<td>"+"ID:"+"<td>"+" 商品名称:"+"<td>"+" 详细说明:"+"<td>"+" 市场价:"+"<td>"+"会员价:"+"<td>"+" 图片:"+"<td>"+"类型:"+"<td>"+"</tr>");
while(rs.next())
{
temp1=rs.getString(1);
temp2=rs.getString(2);
temp3=rs.getString(3);
temp4=rs.getString(4);
temp5=rs.getString(5);
temp6=rs.getString(6);
temp7=rs.getString(7);
out.print("<tr>"+"<td>"+temp1+"<td>"+temp2+"<td>"+temp3+"<td>"+temp4+"<td>"+temp5+"<td>"+"<img src="+temp6+" width=90 height=90>"+"<td>"+temp7+"<td>"+"</tr>");
}
rs.close();
stmt.close();
conn.close();
}
catch(SQLException e)
{
System.err.println("executeQuery:"+e.getMessage());
}
%>
<p><a href="index.jsp">返回主页</a></p>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -