コード例 #1
0
 @RequestMapping(value = "/book/delete/{isbn}", method = RequestMethod.GET)
 public ModelAndView delete(@PathVariable String isbn) {
   if (bookService.getBookByIsbn(isbn) == null) {
     return getErrorView("This book is not exist");
   }
   bookService.delete(isbn);
   ModelAndView modelAndView = new ModelAndView("books");
   modelAndView.getModel().put("books", bookService.findAll());
   return modelAndView;
 }
コード例 #2
0
 @RequestMapping(value = "/book/get", method = RequestMethod.GET)
 public Iterable<Book> getAllBooks() {
   Iterable<Book> books = bookService.findAll();
   return books;
 }
コード例 #3
0
 @RequestMapping(value = "/index", method = RequestMethod.GET)
 public ModelAndView index() {
   ModelMap model = new ModelMap();
   model.put("books", bookService.findAll());
   return new ModelAndView("books", model);
 }