• 大小: 15.61MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-07
  • 语言: 其他
  • 标签: ssm  java  jsp  

资源简介

基于SSM的简单图书管理系统

资源截图

代码片段和文件信息

package com.library.controller;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.library.pojo.Book;
import com.library.pojo.BookType;
import com.library.pojo.Record;
import com.library.service.BookService;
import com.library.service.ReaderService;
import com.library.service.RecordService;

@Controller
public class BookController {
@Autowired
private BookService bookService;
@Autowired
private RecordService recordService;
@Autowired
private ReaderService readerService;

@RequestMapping(“/book/list“)
public String bookList(Model modelHttpServletRequest request) throws Exception{
request.setCharacterEncoding(“UTF-8“);
String name = request.getParameter(“bookName“);
String type = request.getParameter(“bookType“);
String press = request.getParameter(“bookPress“);
List bookList = bookService.queryBook(name type press);
List bookTypeList = bookService.queryAllBookType();
List bookNumberList = bookService.queryBookNumber();
List readerNumberList = readerService.queryReaderNumber();

model.addAttribute(“books“ bookList);
request.getSession().setAttribute(“bookTypes“ bookTypeList);
request.getSession().setAttribute(“bookNumbers“ bookNumberList);
request.getSession().setAttribute(“readerNumbers“ readerNumberList);
model.addAttribute(“bookName“ name);
model.addAttribute(“bookType“ type);
return “admin_books“;
}

@RequestMapping(“/book/edit.action“)
public @ResponseBody Book bookEdit(String number){
Book book = bookService.queryBookByNumber(number);
return book;
}

@RequestMapping(“/book/update.action“)
public @ResponseBody String bookUpdate(Book book){
bookService.updateBookById(book);
return “OK“;
}

/*用book实体接收不了前端传过来的变量,只能一个一个收*/
@RequestMapping(“/book/add.action“)
public @ResponseBody String bookAdd(HttpServletRequest request) throws Exception{
Date publicationdate = null;
Integer pagecount = null;
BigDecimal price = null;
String name = request.getParameter(“name“);
String type = request.getParameter(“type“);
String author = request.getParameter(“anthor“);
String number = request.getParameter(“number“);
String press = request.getParameter(“press“);
String publicationdateStr = request.getParameter(“publicationdate“);
String priceStr = request.getParameter(“price“);
String pagecountStr = request.getParameter(“pagecount“);
String remark = request.getParameter(“remark“);

SimpleDateFormat sdf=new SimpleDateFormat(“yyyy-MM-dd“);
String createtimeStr = sdf.format(new Date());
Date createtime = sdf.parse(createtimeStr);
if(publicationdateSt

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\
     文件         817  2019-07-08 15:32  SSM-LibrarySystem-master\.classpath
     文件        1004  2019-07-08 15:32  SSM-LibrarySystem-master\.project
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\
     文件         555  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\.jsdtscope
     文件          55  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.core.resources.prefs
     文件         357  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.jdt.core.prefs
     文件         465  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.wst.common.component
     文件         335  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2019-07-08 15:32  SSM-LibrarySystem-master\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件        1923  2019-07-08 15:32  SSM-LibrarySystem-master\README.md
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\meta-INF\
     文件          36  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\meta-INF\MANIFEST.MF
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\
     文件       26450  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\admin_books.jsp
     文件       12701  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\admin_booktype.jsp
     文件        4913  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\admin_main.jsp
     文件       22180  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\admin_readers.jsp
     文件       14478  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\admin_readertype.jsp
     文件       12637  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\index.jsp
     文件        4810  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\jsp\record.jsp
     目录           0  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\
     文件        4467  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\aopalliance-1.0.jar
     文件       43581  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\asm-3.3.1.jar
     文件     1862339  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\aspectjweaver-1.8.4.jar
     文件      287192  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\cglib-2.2.2.jar
     文件      232771  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\commons-codec-1.6.jar
     文件       85646  2019-07-08 15:32  SSM-LibrarySystem-master\WebContent\WEB-INF\lib\commons-collections-1.0.jar
............此处省略133个文件信息

评论

共有 条评论