示例#1
0
 @RequestMapping(value = "/chapter/{id}", method = RequestMethod.GET)
 public ModelAndView getArticleOfChapter(
     @PathVariable(value = "id") Integer id, HttpSession session) {
   ChapterModel m = new ChapterModel();
   Chapter ch = m.getChapter(id);
   if (ch != null) {
     List<Article> article = articleModel.getArticleListOfChapter(id);
     BreadCrumbs.getInstance().initCrumbs(id);
     return new ModelAndView("/chapter/show", "chapter", article);
   } else {
     return new ModelAndView("/404");
   }
 }
示例#2
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:/";
   }
 }
示例#3
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:/";
 }