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

电子政务应用

开发平台:

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(classlist.getRequest(request)){
  14. if(classlist.insert()){
  15. mesg = "新图书资料提交成功!";
  16. } else {
  17. mesg = "数据库操作失败";
  18. }
  19. }else {
  20. mesg = "对不起,你提交的参数有错误";
  21. }
  22. }
  23. if (request.getParameter("action")!=null && request.getParameter("action").equals("del")){
  24. try {
  25. int delid = Integer.parseInt(request.getParameter("id"));
  26. if (classlist.delete(delid)){
  27. mesg = "删除成功!";
  28. } else {
  29. mesg = "删除出错!";
  30. }
  31. } catch (Exception e){
  32. mesg = "你要删除的对象错误!";
  33. }
  34. }
  35. %>
  36. <script language="javascript">
  37.   function checkform() {
  38. if (document.form1.bookclassname.value=="") {
  39. document.form1.bookname.focus();
  40. alert("图书名为空!");
  41. return false;
  42. }
  43. return true;
  44.   }
  45. </script>
  46. <%@include file="/bookshop/inc/adm_head.inc"%>
  47. <tr>
  48. <tr><td align="center">现有图书分类:</td></tr>
  49. <% if (classlist.seachBookClass()){
  50. for (int i=0;i<classlist.getClasslist().size();i++){
  51. bookclass bc = (bookclass) classlist.getClasslist().elementAt(i); %>
  52.     <tr align="left"> <td>&nbsp;&nbsp;&nbsp;&nbsp;分类名称:<%= bc.getClassName() %>&nbsp;<a href="adm_addbookclass.jsp?id=<%= bc.getId()%>&action=del">删除</a></td></tr>
  53. <% }
  54. }%>
  55. <td align="center" width="100%"> 
  56.         <p><br>
  57.           <font size="3"><b>添加新的图书分类</b></font></p>
  58.   <% if(!mesg.equals("")){
  59. out.println(mesg);
  60.   }%>
  61.         <form name="form1" method="post" action="adm_addbookclass.jsp">
  62.           <table width="90%" border="0" cellspacing="1" cellpadding="1">
  63.             <tr> 
  64.               <td align="right" width="35%">图书分类名称:</td>
  65.               <td width="65%"> 
  66.                 <input type="text" name="bookclassname" maxlength="40" size="30">
  67.               </td>
  68.             </tr>            
  69.             <tr> 
  70.               <td align="right" width="35%">&nbsp;</td>
  71.               <td width="65%"> 
  72.                 <input type="submit" name="Submit" value="提交" onclick="return(checkform());">
  73.                 <input type="reset" name="reset" value="重置">
  74.               </td>
  75.             </tr>
  76.           </table>
  77.         </form>
  78.         <p>&nbsp;</p>
  79.       </td>
  80. </tr>
  81. <%@include file="/bookshop/inc/adm_tail.inc"%>