コード例 #1
0
  @RequestMapping("editform")
  public ModelAndView editform(@RequestParam("articleId") Integer articleId) {
    ModelAndView mv = new ModelAndView("editform");

    mv.addObject("article", service.getArticle(articleId));
    return mv;
  }
コード例 #2
0
  @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;
  }
コード例 #3
0
  @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;
  }