• 大小: 14.09MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-26
  • 语言: 数据库
  • 标签: java  Web  

资源简介

基于struts2+hibernate+Mysql开发图书管理系统的管理系统,实地测试可过,可能有一些小BUG,但应该不影响运行

资源截图

代码片段和文件信息

package action;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import entity.Books;
import service.BooksDAO;
import service.impl.BooksDAOImpl;

public class BooksAction extends SuperAction{
  Date javaDate;
  private static int hyy=0;
private static final long serialVersionUID = 1L;
public String query() {
hyy = 5;
System.out.print(hyy);
BooksDAO booksdao = new BooksDAOImpl();
List list = booksdao.queryAllBooks();
// 放进session中
if (list != null && list.size() > 0) {
session.setAttribute(“Books_list“ list);
}
return “query_success“;
}
public String add(){
BooksDAO booksDAO = new BooksDAOImpl();
Books books = new Books();
System.out.print(hyy);

  
        SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd“);
     
            try {
 javaDate= sdf.parse(request.getParameter(“publicationDate“));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
            books.setPublicationDate(javaDate);
books.setAuthor(request.getParameter(“Author“));
books.setBookID(request.getParameter(“BookID“));
books.setBookNAME(request.getParameter(“BookNAME“));
books.setBookPRESS(request.getParameter(“BookPRESS“));
books.setContent(request.getParameter(“Content“));
int sum = Integer.parseInt(request.getParameter(“Sum“));
books.setSum(sum);

books.setLoanBookssum(sum);//默认新添加的数没有借出去

if(booksDAO.addBooks(books))
{
return “add_success“;
}
else return “add_failure“;
}
public String delete()
{
BooksDAOImpl booksDAO = new BooksDAOImpl();
String s = request.getParameter(“BookID“);
System.out.println(s);
if(booksDAO.deleteBooks(s))
{
return “delete_success“;
}
else return “delete_failure“;
}

public String modify()
{
String booksID = request.getParameter(“BookID“);
BooksDAO booksDAO = new BooksDAOImpl();
Books s = booksDAO.queryBooksByBookID(booksID);

session.setAttribute(“modify_books“s );
return “modify“;

}
public String save()

{
BooksDAO booksDAO = new BooksDAOImpl();
Books books = new Books();
books.setAuthor(request.getParameter(“Author“));
books.setBookID(request.getParameter(“BookID“));
books.setBookNAME(request.getParameter(“BookNAME“));
books.setBookPRESS(request.getParameter(“BookPRESS“));
books.setContent(request.getParameter(“Content“));
books.setSum(Integer.parseInt(request.getParameter(“Sum“)));
books.setLoanBookssum(Integer.parseInt(request.getParameter(“LoanBookssum“)));
  SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd“);
     
          try {
 javaDate= sdf.parse(request.getParameter(“publicationDate“));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
          books.setPublicationDate(javaDate);
booksDAO.updateBooks(books)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-30 14:10  BookManagementSystem\
     文件        1006  2018-11-06 14:13  BookManagementSystem\.classpath
     文件        1070  2018-10-30 12:47  BookManagementSystem\.project
     目录           0  2018-11-06 19:59  BookManagementSystem\.settings\
     文件         564  2018-10-30 12:47  BookManagementSystem\.settings\.jsdtscope
     文件          87  2018-11-06 19:59  BookManagementSystem\.settings\org.eclipse.core.resources.prefs
     文件         364  2018-10-30 12:47  BookManagementSystem\.settings\org.eclipse.jdt.core.prefs
     文件         594  2018-10-30 14:10  BookManagementSystem\.settings\org.eclipse.wst.common.component
     文件         361  2018-10-30 12:47  BookManagementSystem\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-10-30 12:47  BookManagementSystem\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-10-30 12:47  BookManagementSystem\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2018-11-01 15:07  BookManagementSystem\src\
     目录           0  2019-03-12 22:12  BookManagementSystem\src\action\
     文件        3649  2018-11-09 15:29  BookManagementSystem\src\action\BooksAction.java
     文件        4509  2018-11-27 17:56  BookManagementSystem\src\action\BorrowBooksAction.java
     文件        1446  2019-03-12 22:27  BookManagementSystem\src\action\FilterToLog.java
     文件        3624  2018-11-08 14:13  BookManagementSystem\src\action\StudentsAction.java
     文件        1212  2018-10-30 16:38  BookManagementSystem\src\action\SuperAction.java
     文件        1189  2018-10-30 17:27  BookManagementSystem\src\action\UsersAction.java
     目录           0  2018-10-30 14:58  BookManagementSystem\src\db\
     文件         921  2018-10-30 16:21  BookManagementSystem\src\db\MyHibernateSessionFactory.java
     目录           0  2018-11-08 08:21  BookManagementSystem\src\entity\
     文件        1170  2018-11-07 21:27  BookManagementSystem\src\entity\Books.hbm.xml
     文件        1920  2018-11-07 21:27  BookManagementSystem\src\entity\Books.java
     文件         510  2018-11-07 19:48  BookManagementSystem\src\entity\BorrowBook.hbm.xml
     文件        1393  2018-11-07 19:47  BookManagementSystem\src\entity\BorrowBooks.java
     文件         951  2018-11-05 11:57  BookManagementSystem\src\entity\Students.hbm.xml
     文件        1199  2018-11-01 15:39  BookManagementSystem\src\entity\Students.java
     文件         520  2018-11-05 12:17  BookManagementSystem\src\entity\Users.hbm.xml
     文件         784  2018-10-30 15:59  BookManagementSystem\src\entity\Users.java
     文件        1682  2019-04-12 15:04  BookManagementSystem\src\hibernate.cfg.xml
............此处省略157个文件信息

评论

共有 条评论