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

电子政务应用

开发平台:

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. if (submit!=null && !submit.equals("")){
  13. if(book.getRequest(request)){
  14. if(book.insert()){
  15. mesg = "新图书资料提交成功!";
  16. } else {
  17. mesg = "数据库操作失败";
  18. }
  19. }else {
  20. mesg = "对不起,你提交的参数有错误";
  21. }
  22. }
  23. %>
  24. <script language="javascript">
  25.   function checkform() {
  26. if (document.form1.bookname.value=="") {
  27. document.form1.bookname.focus();
  28. alert("图书名为空!");
  29. return false;
  30. }
  31. if (document.form1.author.value=="") {
  32. alert("作者名为空!");
  33. document.form1.author.focus();
  34. return false;
  35. }
  36. return true;
  37.   }
  38. </script>
  39. <%@include file="/bookshop/inc/adm_head.inc"%>
  40. <tr>
  41. <td align="center" width="77%"> 
  42.         <p><br>
  43.           <font size="3"><b>添加新的图书资料</b></font></p>
  44.   <% if(!mesg.equals("")){
  45. out.println(mesg);
  46.   }%>
  47.         <form name="form1" method="post" action="adm_addbook.jsp">
  48.           <table width="90%" border="0" cellspacing="1" cellpadding="1">
  49.             <tr> 
  50.               <td align="right" width="35%">图书名称:</td>
  51.               <td width="65%"> 
  52.                 <input type="text" name="bookname" maxlength="40" size="30">
  53.               </td>
  54.             </tr>
  55.             <tr> 
  56.               <td align="right" width="35%">作者:</td>
  57.               <td width="65%"> 
  58.                 <input type="text" name="author" maxlength="25" size="20">
  59.               </td>
  60.             </tr>
  61.             <tr> 
  62.               <td align="right" width="35%">出版社:</td>
  63.               <td width="65%"> 
  64.                 <input type="text" name="publish" size="40" maxlength="150">
  65.               </td>
  66.             </tr>
  67.             <tr> 
  68.               <td align="right" width="35%">所属类别:</td>
  69.               <td width="65%"> 
  70.                 <select name="bookclass">
  71. <% if (classlist.seachBookClass()){
  72. for (int i=0;i<classlist.getClasslist().size();i++){
  73. bookclass bc = (bookclass) classlist.getClasslist().elementAt(i); %>
  74.       <option value="<%= bc.getId()%>"><%= bc.getClassName() %></option>
  75. <% }
  76. }%>
  77.                 </select>
  78.               </td>
  79.             </tr>
  80.             <tr> 
  81.               <td align="right" width="35%">书号:</td>
  82.               <td width="65%"> 
  83.                 <input type="text" name="bookno" size="20" maxlength="30">
  84.               </td>
  85.             </tr>
  86.             <tr> 
  87.               <td align="right" width="35%">定价:</td>
  88.               <td width="65%"> 
  89.                 <input type="text" name="price" size="8" maxlength="10">
  90.                 元</td>
  91.             </tr>
  92.             <tr> 
  93.               <td align="right" width="35%">总数量:</td>
  94.               <td width="65%"> 
  95.                 <input type="text" name="amount" size="8" maxlength="10">
  96.                 本</td>
  97.             </tr>
  98.             <tr> 
  99.               <td align="right" width="35%">图书封面:</td>
  100.               <td width="65%"> 
  101.                 <input type="File" name="picture" class=box>
  102.                 </td>
  103.             </tr>
  104.             <tr> 
  105.               <td align="right" width="35%" valign="top">图书简介:</td>
  106.               <td width="65%"> 
  107.                 <textarea name="content" cols="40" rows="6"></textarea>
  108.               </td>
  109.             </tr>
  110.             <tr> 
  111.               <td align="right" width="35%">&nbsp;</td>
  112.               <td width="65%"> 
  113.                 <input type="submit" name="Submit" value="提交" onclick="return(checkform());">
  114.                 <input type="reset" name="reset" value="重置">
  115.               </td>
  116.             </tr>
  117.           </table>
  118.         </form>
  119.         <p>&nbsp;</p>
  120.       </td>
  121. </tr>
  122. <%@include file="/bookshop/inc/adm_tail.inc"%>