MCPcopy Index your code
hub / github.com/castello/spring_basic / modify

Method modify

ch4/BoardController2.java:21–43  ·  view source on GitHub ↗
(BoardDto boardDto, Integer page, Integer pageSize, RedirectAttributes rattr, Model m, HttpSession session)

Source from the content-addressed store, hash-verified

19 BoardService boardService;
20
21 @PostMapping("/modify")
22 public String modify(BoardDto boardDto, Integer page, Integer pageSize, RedirectAttributes rattr, Model m, HttpSession session) {
23
24 String writer = (String)session.getAttribute("id");
25 boardDto.setWriter(writer);
26
27 try {
28 if (boardService.modify(boardDto)!= 1)
29 throw new Exception("Modify failed.");
30
31 rattr.addAttribute("page", page);
32 rattr.addAttribute("pageSize", pageSize);
33 rattr.addFlashAttribute("msg", "MOD_OK");
34 return "redirect:/board/list";
35 } catch (Exception e) {
36 e.printStackTrace();
37 m.addAttribute(boardDto);
38 m.addAttribute("page", page);
39 m.addAttribute("pageSize", pageSize);
40 m.addAttribute("msg", "MOD_ERR");
41 return "board"; // 등록하려던 내용을 보여줘야 함.
42 }
43 }
44
45 @GetMapping("/write")
46 public String write(Model m) {

Callers

nothing calls this directly

Calls 2

setWriterMethod · 0.80
modifyMethod · 0.65

Tested by

no test coverage detected