@RequestMapping(value = "/insertcomment", method = RequestMethod.POST) public String InsertComent( @RequestParam("comicId") String comicId, @RequestParam("comment") String comment, HttpSession httpSession) { System.out.println("comment:" + comment); User user = (User) httpSession.getAttribute("user"); if (user != null) { Comment c = new Comment(); c.setComicId(comicService.GetComic(comicId)); c.setCommentDes(comment); c.setDateTime(new Date()); c.setUserId(user); comicService.InsertComment(c); } return "redirect:/comic/comiclist/" + comicId; }
@ResponseBody @RequestMapping(value = "/insertcommentback") public String InsertComentBack( @RequestParam("comment") String comment, @RequestParam("commentId") int commentId, @RequestParam("toId") String toId, HttpSession httpSession) { User user = (User) httpSession.getAttribute("user"); if (user != null) { CommentSub cs = new CommentSub(); Comment c = comicService.GetComent(commentId); c.setDateTime(new Date()); cs.setCommentId(c); cs.setCommentDes(comment); cs.setToId(comicService.GetUser(toId)); cs.setUpDate(new Date()); cs.setFromId(user); comicService.InsertCommentBack(cs); comicService.UpdateComment(c); return ""; } return null; }