ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • TIL 40th day
    TIL(Today I Learned) 2021. 11. 30. 19:27

    Spring MVC 제공기능

    뷰리졸버

    • 핸들러 어댑터를 통해 논리뷰 이름을 획득 -> ViewResolver 호출 -> 랜더링(JSP 실행)

    Controller

    • 스프링 MVC를 사용할 수 있도록하는 어노테이션
    • Component를 포함(자동 빈 등록)

    @RequestMapping

    • 핸들러와 어댑터를 지원
    • 요청 정보를 매핑
    • 해당 URL 호출
    • 메서드 형식의 컨트롤러(핸들러)를 한곳에 통합할 수 있다.(관리가 수월)
    • 중복되는 URL을 클래스 위에 RequestMapping("URL")로 선언할 수 있다.

    ModelAndView

    • 논리뷰와, 랜더링할 때 필요한 model(파라미터 값을 저장하는) 기능을 포함한다.

    GetMapping, PostMapping

    • HTTP 메서드인 Get, Post 기능을 제공한다.
    • RequestMapping이 포함되어있다.

    RequestParam("username") String username, RequestParam("age") int age, Model model

    
    @RequestParam("username") String username,
    @RequestParam("age") int age, 
    Model model 
    • 위 기능을 통해 파라미터 값을 불러올 수 있다.
    • Model은 데이터 값을 저장할 수 있다.(addAttribute("String", Object))

    'TIL(Today I Learned)' 카테고리의 다른 글

    TIL 43th day  (0) 2021.12.05
    TIL 41th day  (0) 2021.12.01
    TIL 39th day  (0) 2021.11.29
    TIL 37th day(2021.11.27)  (0) 2021.11.27
    TIL 36th day (2021.11.27)  (0) 2021.11.27
Designed by Tistory.