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


'Programming > Spring' 카테고리의 다른 글

IOC / DL / DI  (0) 2018.05.13
Spring Framework  (0) 2018.05.12
CRUD 구현하기 - front end  (0) 2018.02.16
Ajax  (0) 2018.02.15
ViewResolver  (0) 2018.02.14

+ Recent posts