adm_005faddbookclass_jsp.java

来自「这个是我自己写的网上书店的管理系统」· Java 代码 · 共 398 行 · 第 1/2 页

JAVA
398
字号
      out.write("          </td>\r\n");
      out.write("<!--Button4.Content.End-->\r\n");
      out.write("\r\n");
      out.write("<!--Button5.Content.Begin-->\r\n");
      out.write("          <td width=\"14%\"> \r\n");
      out.write("            <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"28\">\r\n");
      out.write("              <tr> \r\n");
      out.write("                <td width=\"100%\"> \r\n");
      out.write("                  <div align=\"center\"><b>\r\n");
      out.write("<!--Button5.Link-->\r\n");
      out.write("<a href=\"adm_user.jsp\">\r\n");
      out.write("<font color=\"#0000FF\">\r\n");
      out.write("<!--Button5-->\r\n");
      out.write("用户管理 \r\n");
      out.write("                          </font></a></b></div>\r\n");
      out.write("                </td>\r\n");
      out.write("              </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("          </td>\r\n");
      out.write("<!--Button5.Content.End-->\r\n");
      out.write("\r\n");
      out.write("<!--Button6.Content.Begin-->\r\n");
      out.write("          <td width=\"12%\"> \r\n");
      out.write("            <table width=\"110%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"28\">\r\n");
      out.write("              <tr> \r\n");
      out.write("                <td width=\"100%\"> \r\n");
      out.write("                  <div align=\"center\"><b>\r\n");
      out.write("<!--Button6.Link-->\r\n");
      out.write("<a href=\"../booklist.jsp\">\r\n");
      out.write("<font color=\"#0000FF\">\r\n");
      out.write("<!--Button6-->\r\n");
      out.write("返回上一界面\r\n");
      out.write("</font></a>  \r\n");
      out.write("                    </b></div>\r\n");
      out.write("                </td>\r\n");
      out.write("              </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("          </td>\r\n");
      out.write("<!--Button6.Content.End-->\r\n");
      out.write("\r\n");
      out.write("<!--Button6.Content.Begin-->\r\n");
      out.write("          <td width=\"14%\"> \r\n");
      out.write("            <table width=\"110%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"28\">\r\n");
      out.write("              <tr> \r\n");
      out.write("                <td width=\"100%\"> \r\n");
      out.write("                  <div align=\"center\"><b>\r\n");
      out.write("<!--Button6.Link-->\r\n");
      out.write("<a href=\"../logout.jsp\">\r\n");
      out.write("<font color=\"#0000FF\">\r\n");
      out.write("<!--Button6-->\r\n");
      out.write("重新登录\r\n");
      out.write("</font></a>  \r\n");
      out.write("                    </b></div>\r\n");
      out.write("                </td>\r\n");
      out.write("              </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("          </td>\r\n");
      out.write("<!--Button6.Content.End-->\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("        </tr>\r\n");
      out.write("      </table>\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      run.op_bookclass classlist = null;
      synchronized (_jspx_page_context) {
        classlist = (run.op_bookclass) _jspx_page_context.getAttribute("classlist", PageContext.PAGE_SCOPE);
        if (classlist == null){
          classlist = new run.op_bookclass();
          _jspx_page_context.setAttribute("classlist", classlist, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');
      run.op_book book = null;
      synchronized (_jspx_page_context) {
        book = (run.op_book) _jspx_page_context.getAttribute("book", PageContext.PAGE_SCOPE);
        if (book == null){
          book = new run.op_book();
          _jspx_page_context.setAttribute("book", book, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

	String mesg = "";
	String submit = request.getParameter("Submit");
	if (submit!=null && !submit.equals("")){		
		if(classlist.getRequest(request)){
			if(classlist.insert()){
				mesg = "新图书资料提交成功!";
			} else {
				mesg = "数据库操作失败";
			}
		}else {
			mesg = "对不起,你提交的参数有错误";
		}
	}
	if (request.getParameter("action")!=null && request.getParameter("action").equals("del")){
	try {
		int delid = Integer.parseInt(request.getParameter("id"));
		if (classlist.delete(delid)){
			mesg = "删除成功!";
		} else {
			mesg = "删除出错!";
		}
	} catch (Exception e){
		mesg = "你要删除的对象错误!";
	}
}

      out.write("\r\n");
      out.write("\r\n");
      out.write("<script language=\"javascript\">\r\n");
      out.write("  function checkform() {\r\n");
      out.write("\tif (document.form1.bookclassname.value==\"\") {\r\n");
      out.write("\t\tdocument.form1.bookname.focus();\r\n");
      out.write("\t\talert(\"图书名为空!\");\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\t\r\n");
      out.write("\r\n");
      out.write("\treturn true;\r\n");
      out.write("\r\n");
      out.write("  }\r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("<table width=\"1000\" align=\"center\">\r\n");
      out.write("<tr>\r\n");
      out.write("<tr><td align=\"center\">现有图书分类:</td></tr>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t\t");
 if (classlist.seachBookClass()){
				for (int i=0;i<classlist.getClasslist().size();i++){
					bookclass bc = (bookclass) classlist.getClasslist().elementAt(i); 
      out.write("\r\n");
      out.write("\t\t\t    <tr align=\"center\"> <td>&nbsp;&nbsp;&nbsp;&nbsp;分类名称:");
      out.print( bc.getClassName() );
      out.write("&nbsp;<a href=\"adm_addbookclass.jsp?id=");
      out.print( bc.getId());
      out.write("&action=del\">删除</a></td></tr>\r\n");
      out.write("\t\t");
		}			
		}
      out.write("\r\n");
      out.write("\t\t\t\r\n");
      out.write("\r\n");
      out.write("<td align=\"center\" width=\"100%\"> \r\n");
      out.write("        <p><br>\r\n");
      out.write("          <font size=\"3\"><b>添加新的图书分类</b></font></p>\r\n");
      out.write("\t\t  ");
 if(!mesg.equals("")){
			out.println(mesg);
		  }
      out.write("\r\n");
      out.write("        <form name=\"form1\" method=\"post\" action=\"adm_addbookclass.jsp\">\r\n");
      out.write("          <table width=\"90%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("            <tr> \r\n");
      out.write("              <td align=\"right\" width=\"35%\">图书分类名称:</td>\r\n");
      out.write("              <td width=\"65%\"> \r\n");
      out.write("                <input type=\"text\" name=\"bookclassname\" maxlength=\"40\" size=\"30\">\r\n");
      out.write("              </td>\r\n");
      out.write("            </tr>            \r\n");
      out.write("            <tr> \r\n");
      out.write("              <td align=\"right\" width=\"35%\">&nbsp;</td>\r\n");
      out.write("              <td width=\"65%\"> \r\n");
      out.write("                <input type=\"submit\" name=\"Submit\" value=\"提交\" onclick=\"return(checkform());\">\r\n");
      out.write("                <input type=\"reset\" name=\"reset\" value=\"重置\">\r\n");
      out.write("              </td>\r\n");
      out.write("            </tr>\r\n");
      out.write("          </table>\r\n");
      out.write("        </form>\r\n");
      out.write("        <p>&nbsp;</p>\r\n");
      out.write("      </td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?