book_modify.jsp
上传用户:tanyanyong
上传日期:2013-06-23
资源大小:1355k
文件大小:5k
源码类别:

电子政务应用

开发平台:

MultiPlatform

  1. <%@ page session="true" %>
  2. <%
  3. if (session.getAttribute("admin")==null || session.getAttribute("admin")==""){
  4. // response.sendRedirect("error.htm");
  5. } %>
  6. <%@ page import="bookshop.book.*" %>
  7. <jsp:useBean id="classlist" scope="page" class="bookshop.run.op_bookclass" />
  8. <jsp:useBean id="book" scope="page" class="bookshop.run.op_book" />
  9. <%
  10. String mesg = "";
  11. String submit = request.getParameter("Submit");
  12. int Id =0;
  13. if (submit!=null && !submit.equals("")){
  14. if(book.getRequest(request)){
  15. if(book.update()){
  16. mesg = "图书资料修改成功!";
  17. } else {
  18. mesg = "数据库操作失败";
  19. }
  20. }else {
  21. mesg = "对不起,你提交的参数有错误";
  22. }
  23. }
  24. if (request.getParameter("id")==null || request.getParameter("id").equals("")) {
  25. mesg = "你要修改的数据参数错误!";
  26. } else {
  27. try {
  28. Id = Integer.parseInt(request.getParameter("id"));
  29. if (!book.getOnebook(Id)){
  30. mesg = "你要修改的数据不存在";
  31. }
  32. } catch (Exception e){
  33. mesg = "你要修改的数据参数错误!";
  34. }
  35. }
  36. %>
  37. <script language="javascript">
  38.   function checkform() {
  39. if (document.form1.id.value=="") {
  40. alert("你要修改的数据不存在!");
  41. return false;
  42. }
  43. if (document.form1.bookname.value=="") {
  44. document.form1.bookname.focus();
  45. alert("图书名为空!");
  46. return false;
  47. }
  48. if (document.form1.author.value=="") {
  49. alert("作者名为空!");
  50. document.form1.author.focus();
  51. return false;
  52. }
  53. return true;
  54.   }
  55. </script>
  56. <%@include file="/bookshop/inc/adm_head.inc"%>
  57. <tr>
  58.  <td align="center" width="77%"> 
  59.         <p><br>
  60.           <font size="3"><b>修改图书资料</b></font></p>
  61.   <% if(!mesg.equals("")){
  62. out.println(mesg);
  63.   } else {
  64. book modibook = (book) book.getBooklist().elementAt(0);   
  65. %>
  66.         <form name="form1" method="post" action="book_modify.jsp">
  67.           <table width="90%" border="0" cellspacing="1" cellpadding="1">
  68.             <tr> 
  69.               <td align="right" width="35%">图书名称:</td>
  70.               <td width="65%"> 
  71.                 <input type="text" name="bookname" maxlength="40" size="30" value="<%= modibook.getBookName() %>">
  72.               </td>
  73.             </tr>
  74.             <tr> 
  75.               <td align="right" width="35%">作者:</td>
  76.               <td width="65%"> 
  77.                 <input type="text" name="author" maxlength="25" size="20" value="<%= modibook.getAuthor() %>">
  78.               </td>
  79.             </tr>
  80.             <tr> 
  81.               <td align="right" width="35%">出版社:</td>
  82.               <td width="65%"> 
  83.                 <input type="text" name="publish" size="40" maxlength="150" value="<%= modibook.getPublish() %>">
  84.               </td>
  85.             </tr>
  86.             <tr> 
  87.               <td align="right" width="35%">所属类别:</td>
  88.               <td width="65%"> 
  89.                 <select name="bookclass">
  90. <% if (classlist.seachBookClass()){
  91. for (int i=0;i<classlist.getClasslist().size();i++){
  92. bookclass bc = (bookclass) classlist.getClasslist().elementAt(i); %>
  93.       <option value="<%= bc.getId()%>" <% if (bc.getId() == modibook.getBookClass()) out.print("selected");%>><%= bc.getClassName() %></option>
  94. <% }
  95. }%>
  96.                 </select>
  97.               </td>
  98.             </tr>
  99.             <tr> 
  100.               <td align="right" width="35%">书号:</td>
  101.               <td width="65%"> 
  102.                 <input type="text" name="bookno" size="20" maxlength="30" value="<%= modibook.getBookNo() %>">
  103.               </td>
  104.             </tr>
  105.             <tr> 
  106.               <td align="right" width="35%">定价:</td>
  107.               <td width="65%"> 
  108.                 <input type="text" name="price" size="8" maxlength="10" value="<%= modibook.getPrince() %>">
  109.                 元</td>
  110.             </tr>
  111.             <tr> 
  112.               <td align="right" width="35%">总数量:</td>
  113.               <td width="65%"> 
  114.                 <input type="text" name="amount" size="8" maxlength="10" value="<%= modibook.getAmount() %>">
  115.                 本</td>
  116.             </tr>
  117.             <tr> 
  118.               <td align="right" width="35%" valign="top">图书封面:</td>
  119.               <td width="65%"> 
  120.                 <input type="text" name="picture" size="8" maxlength="10" value="<%= modibook.getPicture() %>">
  121.                
  122.               </td>
  123.             </tr>
  124.             <tr> 
  125.               <td align="right" width="35%" valign="top">图书简介:</td>
  126.               <td width="65%"> 
  127.                 <textarea name="content" cols="40" rows="6"><%= modibook.getContent() %></textarea>
  128.               </td>
  129.             </tr>
  130.             <tr> 
  131.               <td align="right" width="35%">&nbsp;</td>
  132.               <td width="65%"> 
  133. <input type="hidden" name="id" value="<%= Id %>">
  134.                 <input type="submit" name="Submit" value="提交" onclick="return(checkform());">
  135.                 <input type="reset" name="reset" value="重置">
  136.               </td>
  137.             </tr>
  138.           </table>
  139.         </form> 
  140. <% } %>
  141.         <p>&nbsp;</p>
  142.       </td>
  143. </tr>
  144. <%@include file="/bookshop/inc/adm_tail.inc"%>