Programming/Spring
CRUD구현하기 - Back end
snoohey
2018. 2. 16. 21:13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | @Controller public class PostController { private static final Logger logger = LoggerFactory.getLogger(PostController.class); // ... @RequestMapping(value="/boardDetail/write", method = RequestMethod.GET) public ModelAndView writeDetailBoard() throws Exception{ ModelAndView mv = new ModelAndView("/Sample/boardWrite"); return mv; } @RequestMapping(value = "/boardDetail/insert", method = RequestMethod.POST) public ModelAndView insertBoard(@RequestParam Map<String,Object> commandMap, @RequestPart("file") MultipartFile[] files) throws Exception{ ModelAndView mv = new ModelAndView("redirect:/"); sampleservice.insertBoard(commandMap, files); return mv; } @RequestMapping(value = "/boardDetail/modify/update", method=RequestMethod.PUT) public ModelAndView updateBoard(@ModelAttribute Post post) throws Exception{ sampleservice.updateBoard(post); return new ModelAndView("redirect:/"); } @RequestMapping(value= "/boardDetail/modify/delete/{id}", method=RequestMethod.DELETE) public ModelAndView DeleteBoard(@ModelAttribute Post post) throws Exception { sampleservice.DeleteBoard(id); return new ModelAndView("redirect:/"); } //... } | cs |