[SpringBoot]@RequestParam & @PathVariable

파라미터 값을 넘겨받는 Annotation

###1. @RequestParam

  • 파라미터의 key , value 값을 함께 전달하는 방식 예) http://localhost:8080/board?boardIdx=8
    @RequestMapping("/board")
    public ModelAndView openBoardDetail(@RequestParam("boardIdx") int boardIdx) throws Exception{
     ModelAndView mv = new ModelAndView("/board/restBoardDetail");	
     BoardDto board = boardService.selectBoardDetail(boardIdx);
     mv.addObject("board", board);
     log.debug(boardIdx); //  ----> 8이 출력됨
     return mv;
    }
    

Continue reading

Pagination