• 大小: 19.99MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-07-03
  • 语言: 数据库
  • 标签: 系统  

资源简介

用SSH三大框架:即Spring、Struts、Hibernate,实现的图书管理系统,内附论文报告可供参考,使用IDE:MyEclipse,环境需要配置MySQL和Tomcat。

资源截图

代码片段和文件信息

package org.action;
import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.RequestAware;
import org.model.Book;
import org.service.BookService;
import org.service.LendService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathxmlApplicationContext;
import org.tool.Pager;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

public class BookAction implements RequestAware ModelDriven Preparable{
private int pageNow=1;     //初始页面为第一页
private int pageSize=4;     //每页显示4天记录
private String message;
private File photo;
private Book book=null;
private BookService bookService=null;
private LendService lendService=null;

public void init(){
ApplicationContext ctx = new ClassPathxmlApplicationContext(“applicationContext.xml“);
    bookService = (BookService) ctx.getBean(“bookService“);
    lendService = (LendService) ctx.getBean(“lendService“);
}

public String addBook() throws Exception{
init();
Book bo=bookService.selectBook(book.getISBN());
if(bo!=null){                 //判断要添加的图书是否已经存在
this.setMessage(“ISBN已经存在!“);
return “success“;
}else{
// Book b=new Book();
// b.setISBN(book.getISBN());
// b.setBookName(book.getBookName());
// b.setAuthor(book.getAuthor());
// b.setPublisher(book.getPublisher());
// b.setPrice(book.getPrice());
// b.setCnum(book.getCnum());
// b.setSnum(book.getCnum());
// b.setSummary(book.getSummary());
if(this.getPhoto()!=null){
FileInputStream fis=new FileInputStream(this.getPhoto());
byte[] buffer=new byte[fis.available()];
fis.read(buffer);
book.setPhoto(buffer);
}
if(bookService.addBook(book)){
this.setMessage(“添加成功!“);
return “success“;
}else{
this.setMessage(“添加失败!“);
return “success“;
}
  }
}

public String deleteBook() throws Exception{
// LendDao lendDao = new LendDao();
init();
Book bo=bookService.selectBook(book.getISBN());
if(bo==null){             //首先判断是否存在该图书
this.setMessage(“要删除的图书不存在!“);
return “success“;
}else if(lendService.selectByBookISBN(book.getISBN())!=null){
this.setMessage(“该图书已经被借出故不能删除图书信息!“);
return “success“;
}
bookService.deleteBook(book);
this.setMessage(“删除成功!“);
return “success“;
}

public String selectBook() throws Exception{
init();
Book onebook=bookService.selectBook(book.getISBN());
if(onebook==null){
this.setMessage(“不存在该图书!“);
return “success“;
}
Map request=(Map) ActionContext.getContext().get(“request“);
request.put(“onebook“ onebook);
return “success“;
}

public String getImage() throws Exception{
init();
HttpServl

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4575  2017-08-14 05:50  BookManage-master\book_ssh\.classpath

     文件       1005  2017-08-14 05:50  BookManage-master\book_ssh\.project

     文件        491  2017-08-14 05:50  BookManage-master\book_ssh\.settings\.jsdtscope

     文件        357  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.eclipse.jdt.core.prefs

     文件        468  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.eclipse.wst.common.component

     文件        335  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件         93  2017-08-14 05:50  BookManage-master\book_ssh\.settings\org.jboss.ide.eclipse.as.core.prefs

     文件       4259  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\applicationContext.xml

     文件        171  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\db.properties

     文件       1016  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\hibernate.cfg.xml

     文件       1015  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\action\BookAction-validation.xml

     文件       8251  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\action\BookAction.class

     文件       6311  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\action\LendAction.class

     文件       3117  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\action\LoginAction.class

     文件        795  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\dao\baseDao.class

     文件       6022  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\dao\BookDao.class

     文件       5654  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\dao\LendDao.class

     文件       3317  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\dao\LoginDao.class

     文件       2756  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\dao\StudentDao.class

     文件       1036  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\db\DBConn.class

     文件       2065  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Book.class

     文件       1400  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Book.hbm.xml

     文件       1479  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Lend.class

     文件       1065  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Lend.hbm.xml

     文件       1150  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Login.class

     文件        809  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Login.hbm.xml

     文件       1853  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Student.class

     文件       1277  2017-08-14 05:50  BookManage-master\book_ssh\build\classes\org\model\Student.hbm.xml

............此处省略153个文件信息

评论

共有 条评论