• 大小: 14.64MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-01
  • 语言: Java
  • 标签: ssh  web  java  mysql  

资源简介

这是小弟学习java以来第一个完整的web项目,功能俱全,比如借书,还书,索引,管理员删除书,添加书本,学生预约,都已经实现,差的就是界面是黑白的,没有做前端,因为小弟的前端水平不怎么,水平有限,欢迎下载,希望各位多多下载支持,批评指正,小弟在此谢过了!!!

资源截图

代码片段和文件信息

package beyond.library.action;

import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import beyond.library.dto.BookDto;
import beyond.library.medol.Book;
import beyond.library.service.BookService;
import beyond.library.util.DateUtil;
import beyond.library.util.FileUtil;
import beyond.library.util.Id_factory;
import beyond.library.util.InfoUtil;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ModelDriven;

@Component(“addBookAction“)
@Scope(“prototype“)
public class AddBookAction implements ModelDriven Action {

    private BookDto bookDto;
    private String addResult;
    private Book book;
    private BookService bookService;
    private int count;
    private List book_ids = new ArrayList();

    public String execute() throws Exception {
if (AddBook()) {
    Id_factory.updateBookId(bookDto.getKind_id());
    return “addSuccess“;
}
return “addFailed“;
    }

    private boolean AddBook() {
for (int i = 0; i < count; i++) {
    if (!assignmentBook(i))
return false;
    bookService.addBook(book);
}
return true;
    }

    /**
     * 把bookDto中的所有信息转到book中
     * 
     * @return 如果bookDto中的信息不符合标准,返回false
     */
    private boolean assignmentBook(int i) {
if (bookDto.getKind_id() == null && ““.equals(bookDto.getKind_id())) {
    return false;
}
bookDto
.setBook_id(Id_factory.book_id_factory(bookDto.getKind_id())
+ i);
String book_name = bookDto.getBook_name();
String author = bookDto.getAuthor();
String publishing_company = bookDto.getPublishing_company();
String publishing_date = bookDto.getPublishing_date();
float price = bookDto.getPrice();
String image = imageUpload();
String introduce = bookDto.getIntroduce();
if (book_name == null || book_name == ““ || author == null
|| author == ““ || publishing_company == null
|| publishing_company == ““ || publishing_date == null
|| publishing_date == ““ || price <= 1 || image == null)
    return false;
book = new Book();
book.setBook_id(bookDto.getBook_id());
book_ids.add(book.getBook_id());
this.book.setAuthor(author);
this.book.setBook_name(book_name);
book.setPrice(price);
book.setPublishing_company(publishing_company);
book.setIntroduce(introduce);
book.setAddedDate(DateUtil.getNowDate());
Date date = null;
try {
    date = new SimpleDateFormat(“yyyy-MM-dd“).parse(publishing_date);
} catch (ParseException e) {
    return false;
}
book.setPublishing_date(date);
book.setImage(image);
return true;
    }

    /**
     * 上传要增加书本的图片信息
     * 
     * @return 返回书本图片的名称
     */
    private String imageUpload() {
String bookImagePath = InfoUtil.UPLOAD_URL;
Fil

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

     文件      39424  2013-06-03 20:53  图书馆图书管理系统说明.doc

     文件        844  2013-06-03 16:49  library\.classpath

     文件       1040  2013-06-03 16:49  library\.project

     文件        503  2013-06-03 16:49  library\.settings\.jsdtscope

     文件        364  2013-06-03 16:49  library\.settings\org.eclipse.jdt.core.prefs

     文件        473  2013-06-03 16:49  library\.settings\org.eclipse.wst.common.component

     文件        348  2013-06-03 16:49  library\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2013-06-03 16:49  library\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2013-06-03 16:49  library\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       3552  2013-06-03 16:30  library\build\classes\bean.xml

     文件       5887  2013-06-03 16:52  library\build\classes\beyond\library\action\AddBookAction.class

     文件       2874  2013-06-03 16:52  library\build\classes\beyond\library\action\BookDetailsAction.class

     文件       2416  2013-06-03 16:52  library\build\classes\beyond\library\action\BorrowBookAction.class

     文件       3024  2013-06-03 17:54  library\build\classes\beyond\library\action\BorrowedInfoAction.class

     文件       2017  2013-06-03 16:52  library\build\classes\beyond\library\action\DeleteBookAction.class

     文件       3711  2013-06-03 16:52  library\build\classes\beyond\library\action\IndexAction.class

     文件       3200  2013-06-03 16:52  library\build\classes\beyond\library\action\ManagerLoginAction.class

     文件       1599  2013-06-03 16:52  library\build\classes\beyond\library\action\ManagerLogoutAction.class

     文件       3823  2013-06-03 16:52  library\build\classes\beyond\library\action\NewBooksAction.class

     文件       2173  2013-06-03 16:52  library\build\classes\beyond\library\action\RenewBookAction.class

     文件       2406  2013-06-03 17:09  library\build\classes\beyond\library\action\ReservationBookAction.class

     文件       2860  2013-06-03 17:51  library\build\classes\beyond\library\action\ReturnBookAction.class

     文件       2809  2013-06-03 16:52  library\build\classes\beyond\library\action\SettleAccountsAction.class

     文件       4057  2013-06-03 18:19  library\build\classes\beyond\library\action\StudentHandlerAction.class

     文件       3595  2013-06-03 16:52  library\build\classes\beyond\library\action\StudentLoginAction.class

     文件       1372  2013-06-03 16:52  library\build\classes\beyond\library\action\StudentLogoutAction.class

     文件       3321  2013-06-03 16:52  library\build\classes\beyond\library\action\StudentRegisterAction.class

     文件        703  2013-06-03 16:52  library\build\classes\beyond\library\action\Student_infoAction.class

     文件       3243  2013-06-03 16:52  library\build\classes\beyond\library\action\UpdatePasswordAction.class

     文件        288  2013-06-03 16:52  library\build\classes\beyond\library\dao\BookDAO.class

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

评论

共有 条评论