用jsp技术开发的网络书店
用户注册登录
浏览购书
购物车
下订单
留言功能
源代码在线查看: booksearch.jsp
request.setCharacterEncoding("GB2312");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:bookshoplk","sa","");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=null;
%>
String s_admin=(String)session.getAttribute("admin");
if(s_admin==null){
response.sendRedirect("checklogin.jsp");
}
%>
String s_bookid="";
String s_bookname="";
String s_author="";
String s_publisherid="";
String s_pubdate="";
String s_pubdate2="";
String s_price="";
String s_price2="";
String s_quantity="";
String s_quantity2="";
String s_place="";
String s_type="";
String op = request.getParameter("op");
{
if(op!=null&&op.equals("search"))
{
s_bookid=request.getParameter("bookid");
s_bookname=request.getParameter("bookname");
s_author=request.getParameter("author");
s_publisherid=request.getParameter("publisherid");
s_pubdate=request.getParameter("pubdate");
s_pubdate2=request.getParameter("pubdate2");
s_price=request.getParameter("price");
s_price2=request.getParameter("price2");
s_quantity=request.getParameter("quantity");
s_quantity2=request.getParameter("quantity2");
s_place=request.getParameter("place");
s_type=request.getParameter("type");
String s_where="";
if(!s_bookid.equals(""))
s_where+=" and bookid like'%"+s_bookid+"%' ";
if(!s_bookname.equals(""))
s_where+=" and bookname like'%"+s_bookname+"%' ";
if(!s_author.equals(""))
s_where+=" and author like'%"+s_author+"%' ";
if(!s_publisherid.equals(""))
s_where+=" and book.publisherid ='"+s_publisherid+"' ";
if(!s_pubdate.equals(""))
s_where+=" and pubdate >='"+s_pubdate+"' ";
if(!s_pubdate2.equals(""))
s_where+=" and pubdate
if(!s_price.equals(""))
s_where+=" and price >='"+s_price+"' ";
if(!s_price2.equals(""))
s_where+=" and price
if(!s_quantity.equals(""))
s_where+=" and quantity >='"+s_quantity+"' ";
if(!s_quantity2.equals(""))
s_where+=" and quantity
if(!s_place.equals(""))
s_where+=" and place like '%"+s_place+"%' ";
if(!s_type.equals(""))
s_where+=" and type ='"+s_type+"' ";
session.setAttribute("s_where",s_where);
response.sendRedirect("booklist.jsp?op=show¤tpage=1");
}
}
%>
书号
书名
作者
出版社
所有出版社
ResultSet rs2=stmt.executeQuery("select * from publisher ");
while(rs2.next()){
%>
出版日期
至
(格式:2004-09-01)
价格
至
库存数量
至
存储位置
类别
所有类别
普通
新书
精品