ziduan_result.jsp
上传用户:cnkaiguan
上传日期:2014-08-25
资源大小:5403k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@page contentType="text/html;charset=gbk" %>
  2. <%@page import="java.sql.*" %>
  3. <%
  4. out.print("<table border>");
  5. out.print("<tr>");
  6. out.print("<th width=72>图书编号</td>");
  7.     out.print("<th width=72>图书类别</td>");
  8.     out.print("<th width=68>图书名称</td>");
  9.     out.print("<th width=62>作者</td>");
  10.     out.print("<th width=70>供应商</td>");
  11.     out.print("<th width=84>出版日期</td>");
  12.     out.print("<th width=54>售价</td>");
  13.     out.print("<th width=65>库存量</td>");
  14.     out.print("<th width=50>是否发布</td>");
  15.     out.print("<th width=50>是否热点书</td>");
  16.     out.print("<th width=52>销售量</td>");
  17. out.print("<tr>");
  18. String sidbook=request.getParameter("idbook");
  19. String idbook=new String(sidbook.getBytes("iso-8859-1"));
  20. String scategoryname=request.getParameter("selectcategoryname");
  21. String categoryname=new String(scategoryname.getBytes("iso-8859-1"));
  22. String sbookname=request.getParameter("bookname");
  23. String bookname=new String(sbookname.getBytes("iso-8859-1"));
  24. String sauthor=request.getParameter("author");
  25. String author=new String(sauthor.getBytes("iso-8859-1"));
  26. String ssuppliername=request.getParameter("suppliername");
  27. String suppliername=new String(ssuppliername.getBytes("iso-8859-1"));
  28. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  29. Connection con=DriverManager.getConnection("jdbc:odbc:booksystem");
  30. Statement sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
  31. ResultSet rs=sql.executeQuery("select * from books where idbook='"+idbook+"' and categoryname='"+categoryname+"' or bookname='"+bookname+"' or author='"+author+"' or suppliername='"+suppliername+"'");
  32. while(rs.next())
  33. {
  34. String a,b,c,d,e,f,g,h,i,j,k;
  35. a=rs.getString(1);
  36. out.print("<td>"+a+"</td>");
  37. b=rs.getString(2);
  38. out.print("<td>"+b+"</td>");
  39. c=rs.getString(3);
  40. out.print("<td>"+c+"</td>");
  41. d=rs.getString(4);
  42. out.print("<td>"+d+"</td>");
  43. e=rs.getString(5);
  44. out.print("<td>"+e+"</td>");
  45. f=rs.getString(6);
  46. out.print("<td>"+f+"</td>");
  47. g=rs.getString(7);
  48. out.print("<td>"+g+"</td>");
  49. h=rs.getString(8);
  50. out.print("<td>"+h+"</td>");
  51. i=rs.getString(9);
  52. out.print("<td>"+i+"</td>");
  53. j=rs.getString(10);
  54. out.print("<td>"+j+"</td>");
  55. k=rs.getString(11);
  56. out.print("<td>"+k+"</td>");
  57. out.print("<tr>");
  58. }
  59. //else 
  60. //out.print("暂无此书!");
  61. con.close();
  62. %>