Beispiel #1
0
 @RequestMapping(value = "/chapter/new", method = RequestMethod.POST)
 public String add(@ModelAttribute("chapter") Chapter chapter, BindingResult result) {
   validatorHelpers.validate(chapter, result);
   if (result.hasErrors()) {
     return "/chapter/new";
   } else {
     chapterModel.createChapter(chapter);
     ChapterHelpers.getInstance().showTree();
     return "redirect:/";
   }
 }
Beispiel #2
0
 @RequestMapping(value = "/chapter/delete/{id}", method = RequestMethod.GET)
 public String delete(@PathVariable(value = "id") Integer id) {
   chapterModel.deleteChapter(id);
   ChapterHelpers.getInstance().showTree();
   return "redirect:/";
 }