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

Jsp/Servlet

开发平台:

Java

  1. <%@page contentType="text/html;charset=gbk" %>
  2. <%@page import="java.sql.*" %>
  3. <%
  4. String sidbook=request.getParameter("idbook");
  5. String idbook=new String(sidbook.getBytes("iso-8859-1"));
  6. String scategoryname=request.getParameter("categoryname");
  7. String categoryname=new String(scategoryname.getBytes("iso-8859-1"));
  8. String sbookname=request.getParameter("bookname");
  9. String bookname=new String(sbookname.getBytes("iso-8859-1"));
  10. String sauthor=request.getParameter("author");
  11. String author=new String(sauthor.getBytes("iso-8859-1"));
  12. String ssuppliername=request.getParameter("suppliername");
  13. String suppliername=new String(ssuppliername.getBytes("iso-8859-1"));
  14. String soutday=request.getParameter("outday");
  15. String outday=new String(soutday.getBytes("iso-8859-1"));
  16. String sprice=request.getParameter("price");
  17. String price=new String(sprice.getBytes("iso-8859-1"));
  18. String sstock=request.getParameter("stock");
  19. String stock=new String(sstock.getBytes("iso-8859-1"));
  20. String sfabu=request.getParameter("selectfabu");
  21. String fabu=new String(sfabu.getBytes("iso-8859-1"));
  22. String shotdeal=request.getParameter("selecthotdeal");
  23. String hotdeal=new String(shotdeal.getBytes("iso-8859-1"));
  24. String ssale=request.getParameter("sale");
  25. String sale=new String(ssale.getBytes("iso-8859-1"));
  26. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  27. Connection con=DriverManager.getConnection("jdbc:odbc:booksystem");
  28. Statement sql=con.createStatement();
  29. ResultSet rs=sql.executeQuery("select * from books where idbook='"+idbook+"'");
  30. if(rs.next())
  31. {
  32. sql.executeUpdate("update  books set categoryname='"+categoryname+"' where idbook='"+idbook+"'");
  33. sql.executeUpdate("update  books set bookname='"+bookname+"' where idbook='"+idbook+"'");
  34. sql.executeUpdate("update  books set author='"+author+"' where idbook='"+idbook+"'");
  35. sql.executeUpdate("update  books set suppliername='"+suppliername+"' where idbook='"+idbook+"'");
  36. sql.executeUpdate("update  books set outday='"+outday+"' where idbook='"+idbook+"'");
  37. sql.executeUpdate("update  books set price='"+price+"' where idbook='"+idbook+"'");
  38. sql.executeUpdate("update  books set stock='"+stock+"' where idbook='"+idbook+"'");
  39. sql.executeUpdate("update  books set fabu='"+fabu+"' where idbook='"+idbook+"'");
  40. sql.executeUpdate("update  books set hotdeal='"+hotdeal+"' where idbook='"+idbook+"'");
  41. sql.executeUpdate("update  books set sale='"+sale+"' where idbook='"+idbook+"'");
  42. }
  43. else
  44. out.print("<strong>暂无此书(图书编号:'"+idbook+"')!</strong>"+"<p>");
  45.   rs=sql.executeQuery("select * from books ");
  46. out.print("数据库中的书目如下: ");
  47. out.print("<table border>");
  48. out.print("<tr>");
  49. out.print("<th width=72>图书编号</td>");
  50.     out.print("<th width=72>图书类别</td>");
  51. out.print("<th width=50>图书名称</td>");
  52. out.print("<th width=50>作者</td>");   
  53.     out.print("<th width=62>出 版 商</td>");
  54.     out.print("<th width=50>出版日期</td>");   
  55.     out.print("<th width=50>售价</td>");
  56.     out.print("<th width=50>库存(本)</td>");
  57. out.print("<th width=50>是否发布</td>");
  58. out.print("<th width=50>是否热点书</td>");   
  59.     out.print("<th width=50>出售(本)</td>");
  60. out.print("</tr>");
  61. while(rs.next())
  62. {
  63. String a,b,c,d,e,f,g,h,i,j,k;
  64. out.print("<tr>");
  65. a=rs.getString(1);
  66. out.print("<td>"+a+"</td>");
  67. b=rs.getString(2);
  68. out.print("<td>"+b+"</td>");
  69. c=rs.getString(3);
  70. out.print("<td>"+c+"</td>");
  71. d=rs.getString(4);
  72. out.print("<td>"+d+"</td>");
  73. e=rs.getString(5);
  74. out.print("<td>"+e+"</td>");
  75. f=rs.getString(6);
  76. out.print("<td>"+f+"</td>");
  77. g=rs.getString(7);
  78. out.print("<td>"+g+"</td>");
  79. h=rs.getString(8);
  80. out.print("<td>"+h+"</td>");
  81. i=rs.getString(9);
  82. out.print("<td>"+i+"</td>");
  83. j=rs.getString(10);
  84. out.print("<td>"+j+"</td>");
  85. k=rs.getString(11);
  86. out.print("<td>"+k+"</td>");
  87. out.print("</tr>");
  88. }
  89. con.close();
  90. %>