java写的书店管理系统,功能比较完善,对学习java 有很多帮助.
源代码在线查看: __addbook.java
/* compiled from JSP: /manage/addbook.jsp
*
* This code was automatically generated at 14:23:48 on 2004-3-2
* by weblogic.servlet.jsp.Jsp2Java -- do not edit.
*/
package jsp_servlet._manage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
// User imports
import org.pan.web.book.bookclass; //[ /manage/addbook.jsp; Line: 7]
// built-in init parameters:
// boolean _verbose -- wants debugging
// Well-known variables:
// JspWriter out -- to write to the browser
// HttpServletRequest request -- the request object.
// HttpServletResponse response -- the response object.
// PageContext pageContext -- the page context for this JSP
// HttpSession session -- the session object for the client (if any)
// ServletContext application -- The servlet (application) context
// ServletConfig config -- The ServletConfig for this JSP
// Object page -- the instance of this page's implementation class (i.e., 'this')
/**
* This code was automatically generated at 14:23:48 on 2004-3-2
* by weblogic.servlet.jsp.Jsp2Java -- do not edit.
*
* Copyright (c) 2004 by BEA Systems, Inc. All Rights Reserved.
*/
public final class __addbook
extends
weblogic.servlet.jsp.JspBase
implements weblogic.servlet.jsp.StaleIndicator
{
// StaleIndicator interface public boolean _isStale() { weblogic.servlet.jsp.StaleChecker sci =(weblogic.servlet.jsp.StaleChecker)(getServletConfig().getServletContext()); java.io.File f = null; long lastModWhenBuilt = 0L; if (sci.isResourceStale("/manage/addbook.jsp", 1046050544000L, "7.0.1.0")) return true; return false; } public static boolean _staticIsStale(weblogic.servlet.jsp.StaleChecker sci) { java.io.File f = null; long lastModWhenBuilt = 0L; if (sci.isResourceStale("/manage/addbook.jsp", 1046050544000L, "7.0.1.0")) return true; return false; }
public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
{
// declare and set well-known variables:
javax.servlet.ServletConfig config = getServletConfig();
javax.servlet.ServletContext application = config.getServletContext();
javax.servlet.jsp.tagext.Tag _activeTag = null;
// variables for Tag extension protocol
Object page = this;
javax.servlet.jsp.JspWriter out;
javax.servlet.jsp.PageContext pageContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true);
response.setHeader("Content-Type", "text/html; charset=gb2312"); out = pageContext.getOut(); JspWriter _originalOut = out;
javax.servlet.http.HttpSession session = request.getSession(true);
try { // error page try block response.setContentType("text/html; charset=gb2312"); out.print("\r\n\r\n"); //[ /manage/addbook.jsp; Line: 3] if (session.getAttribute("admin")==null || session.getAttribute("admin")==""){ //[ /manage/addbook.jsp; Line: 4] response.sendRedirect("error.htm"); //[ /manage/addbook.jsp; Line: 5] } //[ /manage/addbook.jsp; Line: 6] //[ /manage/addbook.jsp; Line: 6] out.print("\r\n"); out.print("\r\n"); org.pan.web.bookclasslist classlist = null; //[ /manage/addbook.jsp; Line: 8] classlist = (org.pan.web.bookclasslist)pageContext.getAttribute("classlist"); //[ /manage/addbook.jsp; Line: 8] if (classlist == null) { // begin 'classlist' instantiation block... //[ /manage/addbook.jsp; Line: 8] { // Don't need to synchronize on page scope //[ /manage/addbook.jsp; Line: 8] classlist = (org.pan.web.bookclasslist)pageContext.getAttribute("classlist"); //[ /manage/addbook.jsp; Line: 8] if (classlist == null) { // begin 'classlist' synchronized instantiation block... //[ /manage/addbook.jsp; Line: 8] classlist = new org.pan.web.bookclasslist(); //[ /manage/addbook.jsp; Line: 8] pageContext.setAttribute("classlist", classlist); //[ /manage/addbook.jsp; Line: 8] } // end synchronized bean instantiation block... //[ /manage/addbook.jsp; Line: 8] } // end synchronized bean scope block... //[ /manage/addbook.jsp; Line: 8] } // end bean instantiation block... //[ /manage/addbook.jsp; Line: 8] out.print("\r\n"); org.pan.web.booksmn book = null; //[ /manage/addbook.jsp; Line: 9] book = (org.pan.web.booksmn)pageContext.getAttribute("book"); //[ /manage/addbook.jsp; Line: 9] if (book == null) { // begin 'book' instantiation block... //[ /manage/addbook.jsp; Line: 9] { // Don't need to synchronize on page scope //[ /manage/addbook.jsp; Line: 9] book = (org.pan.web.booksmn)pageContext.getAttribute("book"); //[ /manage/addbook.jsp; Line: 9] if (book == null) { // begin 'book' synchronized instantiation block... //[ /manage/addbook.jsp; Line: 9] book = new org.pan.web.booksmn(); //[ /manage/addbook.jsp; Line: 9] pageContext.setAttribute("book", book); //[ /manage/addbook.jsp; Line: 9] } // end synchronized bean instantiation block... //[ /manage/addbook.jsp; Line: 9] } // end synchronized bean scope block... //[ /manage/addbook.jsp; Line: 9] } // end bean instantiation block... //[ /manage/addbook.jsp; Line: 9] out.print("\r\n"); //[ /manage/addbook.jsp; Line: 10] String mesg = ""; //[ /manage/addbook.jsp; Line: 11] String submit = request.getParameter("Submit"); //[ /manage/addbook.jsp; Line: 12] if (submit!=null && !submit.equals("")){ //[ /manage/addbook.jsp; Line: 13] if(book.getRequest(request)){ //[ /manage/addbook.jsp; Line: 14] if(book.insert()){ //[ /manage/addbook.jsp; Line: 15] mesg = "新图书资料提交成功!"; //[ /manage/addbook.jsp; Line: 16] } else { //[ /manage/addbook.jsp; Line: 17] mesg = "数据库操作失败"; //[ /manage/addbook.jsp; Line: 18] } //[ /manage/addbook.jsp; Line: 19] }else { //[ /manage/addbook.jsp; Line: 20] mesg = "对不起,你提交的参数有错误"; //[ /manage/addbook.jsp; Line: 21] } //[ /manage/addbook.jsp; Line: 22] } //[ /manage/addbook.jsp; Line: 23] out.print("\r\n\r\n\r\n\r\n好易多网上书店管理系统\r\n\r\n\r\n function checkform() {\r\n\tif (document.form1.bookname.value==\"\") {\r\n\t\tdocument.form1.bookname.focus();\r\n\t\talert(\"图书名为空!\");\r\n\t\treturn false;\r\n\t}\r\n\tif (document.form1.author.value==\"\") {\r\n\t\talert(\"作者名为空!\");\r\n\t\tdocument.form1.author.focus();\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"); out.print(" \r\n \r\n \r\n 回管理首页\r\n \r\n \r\n 商店图书查询\r\n \r\n \r\n 添加图书资料\r\n \r\n \r\n 订单信息查询\r\n \r\n \r\n 用户信息查询\r\n \r\n \r\n 退出\r\n \r\n \r\n \r\n \r\n \r\n 添加新的图书资料\r\n\t\t "); if(!mesg.equals("")){ //[ /manage/addbook.jsp; Line: 86] out.println(mesg); //[ /manage/addbook.jsp; Line: 87] } //[ /manage/addbook.jsp; Line: 88] //[ /manage/addbook.jsp; Line: 88] out.print("\r\n \r\n \r\n \r\n 图书名称:\r\n \r\n \r\n \r\n \r\n \r\n 作者:\r\n \r\n \r\n \r\n \r\n \r\n 出版社:\r\n \r\n \r\n \r\n \r\n \r\n 所属类别:\r\n \r\n \r\n\t\t"); if (classlist.excute()){ //[ /manage/addbook.jsp; Line: 113] for (int i=0;i bookclass bc = (bookclass) classlist.getClasslist().elementAt(i); //[ /manage/addbook.jsp; Line: 115] //[ /manage/addbook.jsp; Line: 115] out.print("\r\n\t\t\t out.print(String.valueOf( bc.getId())); //[ /manage/addbook.jsp; Line: 116] out.print("\">"); out.print(String.valueOf( bc.getClassName() )); //[ /manage/addbook.jsp; Line: 116] out.print("\r\n\t\t"); } //[ /manage/addbook.jsp; Line: 117] } //[ /manage/addbook.jsp; Line: 118] //[ /manage/addbook.jsp; Line: 118] out.print("\t\r\n\t\t\t\t\t\r\n \r\n \r\n \r\n \r\n 书号:\r\n \r\n \r\n \r\n \r\n \r\n 定价:\r\n \r\n \r\n 元\r\n \r\n \r\n 总数量:\r\n \r\n \r\n 本\r\n \r\n \r\n 图书简介:\r\n \r\n \r\n \r\n \r\n \r\n out.print("\"right\" width=\"35%\"> \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 多智能网络有限公司开发\r\n CopyRight@2003 \r\n Email:pz990@163.net\r\n \r\n \r\n \r\n\r\n\r\n\r\n"); book.close(); //[ /manage/addbook.jsp; Line: 172] //[ /manage/addbook.jsp; Line: 172] } catch (Throwable __ee) { while (out != null && out != _originalOut) out = pageContext.popBody(); ((weblogic.servlet.jsp.PageContextImpl)pageContext).handlePageException((Throwable)__ee); }
//before final close brace...
}
}