资源简介

简单的一个图书管理系统,采用SpringMVC三层架构,数据库采用mysql数据库,JDBC查询,初学者练手学习不错的选择,数据库文件在项目里面,解压出来打开就看到了。

资源截图

代码片段和文件信息

package com.action;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import com.actionForm.BookForm;
import org.apache.struts.action.Action;
import com.dao.BookDAO;
import java.util.Date;

public class Book extends Action {
    private BookDAO bookDAO = null;
    public Book() {
        this.bookDAO = new BookDAO();
    }

    public ActionForward execute(ActionMapping mapping ActionForm form
                                 HttpServletRequest request
                                 HttpServletResponse response) {
        String action =request.getParameter(“action“);
        System.out.println(“\nbook*********************action=“+action);
        if(action==null||““.equals(action)){
            request.setAttribute(“error““您的操作有误!“);
            return mapping.findForward(“error“);
        }else if(“bookAdd“.equals(action)){
            return bookAdd(mappingformrequestresponse);
        }else if(“bookQuery“.equals(action)){
            return bookQuery(mappingformrequestresponse);
        }else if(“bookModifyQuery“.equals(action)){
            return bookModifyQuery(mappingformrequestresponse);
        }else if(“bookModify“.equals(action)){
            return bookModify(mappingformrequestresponse);
        }else if(“bookDel“.equals(action)){
            return bookDel(mappingformrequestresponse);
        }else if(“bookDetail“.equals(action)){
            return bookDetail(mappingformrequestresponse);
        }else if(“bookifQuery“.equals(action)){
            return bookifQuery(mappingformrequestresponse);
        }
        request.setAttribute(“error““操作失败!“);
        return mapping.findForward(“error“);
    }
    /***********************添加图书信息**************************/
    private ActionForward bookAdd(ActionMapping mapping ActionForm form
                              HttpServletRequest request
                              HttpServletResponse response){
           BookForm bookForm = (BookForm) form;
           bookForm.setBarcode(bookForm.getBarcode());
           bookForm.setBookName(bookForm.getBookName());
           bookForm.setTypeId(bookForm.getTypeId());
           bookForm.setAuthor(bookForm.getAuthor());
           bookForm.setTranslator(bookForm.getTranslator());
           bookForm.setIsbn(bookForm.getIsbn());
           bookForm.setPrice(bookForm.getPrice());
           bookForm.setPage(bookForm.getPage());
           bookForm.setBookcaseid(bookForm.getBookcaseid());    
           //获取系统日期
           Date date1=new Date();
           java.sql.Date date=new java.sql.Date(date1.getTime());
           bookForm.setInTime(date.toString());
           bookForm.setOperator(bookForm.getOperator());
           int a=bookDAO.insert(bookForm);
           if(a==1){

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-02-21 11:56  Bookstore\
     文件        2306  2018-04-19 23:50  Bookstore\.classpath
     目录           0  2019-02-21 11:56  Bookstore\.myeclipse\
     文件         300  2018-04-19 17:46  Bookstore\.mymetadata
     文件        1752  2018-04-19 22:44  Bookstore\.project
     目录           0  2018-05-17 16:16  Bookstore\.settings\
     文件         500  2018-04-19 17:43  Bookstore\.settings\.jsdtscope
     文件          52  2018-05-17 16:15  Bookstore\.settings\org.eclipse.core.runtime.prefs
     文件         364  2018-04-19 17:43  Bookstore\.settings\org.eclipse.jdt.core.prefs
     文件         465  2018-04-19 17:43  Bookstore\.settings\org.eclipse.wst.common.component
     文件         252  2018-04-19 17:43  Bookstore\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-04-19 17:43  Bookstore\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-04-19 17:43  Bookstore\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件        2475  2019-02-21 11:55  Bookstore\190221115523.psc
     目录           0  2018-04-20 00:30  Bookstore\WebRoot\
     目录           0  2018-04-19 23:38  Bookstore\WebRoot\CSS\
     文件        3068  2009-05-27 17:46  Bookstore\WebRoot\CSS\style.css
     目录           0  2018-04-19 23:38  Bookstore\WebRoot\Images\
     文件       35840  2009-05-27 17:46  Bookstore\WebRoot\Images\Thumbs.db
     文件        6768  2009-05-27 17:46  Bookstore\WebRoot\Images\borrowBackRenew.gif
     文件        6761  2009-05-27 17:46  Bookstore\WebRoot\Images\borrowBackRenew_back.gif
     文件        6823  2009-05-27 17:46  Bookstore\WebRoot\Images\borrowBackRenew_r.gif
     文件        7379  2009-05-27 17:46  Bookstore\WebRoot\Images\borrow_if.gif
     文件          96  2009-05-27 17:46  Bookstore\WebRoot\Images\copyright_t.gif
     文件        4051  2009-05-27 17:46  Bookstore\WebRoot\Images\error.jpg
     文件        1471  2009-05-27 17:46  Bookstore\WebRoot\Images\error_b.gif
     文件         354  2009-05-27 17:46  Bookstore\WebRoot\Images\item_out.gif
     文件         354  2009-05-27 17:46  Bookstore\WebRoot\Images\item_over.gif
     文件       26767  2009-05-27 17:46  Bookstore\WebRoot\Images\login.jpg
     文件        8374  2009-05-27 17:46  Bookstore\WebRoot\Images\main_booksort.gif
     文件         141  2009-05-27 17:46  Bookstore\WebRoot\Images\main_booksort_1.gif
............此处省略181个文件信息

评论

共有 条评论