@RequestMapping("editform") public ModelAndView editform(@RequestParam("articleId") Integer articleId) { ModelAndView mv = new ModelAndView("editform"); mv.addObject("article", service.getArticle(articleId)); return mv; }
@RequestMapping("my_view_article") public ModelAndView getMyArticle(@RequestParam("id") Integer id) { ModelAndView mv = new ModelAndView("my_view_article"); mv.addObject("article", service.getArticle(id)); return mv; }
@RequestMapping("edit") public ModelAndView edit( @RequestParam("tit") String tit, @RequestParam("cont") String cont, @RequestParam("desc") String desc, @RequestParam("articleId") Integer articleId) { ModelAndView mv = new ModelAndView("my_view_articles"); Article article = service.getArticle(articleId); article.setContent(cont); article.setTitle(tit); article.setDescription(desc); service.updateArticle(article); return mv; }