RedirectAttributes

    [Spring] RedirectAttributes

    [Spring] RedirectAttributes

    PRG 패턴이란? - POST방식으로 어떤 처리를 하고 Redirect하여 GET방식으로 특정한 페이지로 이동하는 패턴 스프링MVC에서는 PRG패턴을 위해 RedirectAttributes 타입을 제공한다. addAttribute( 키, 값) - 리다이렉트할때 쿼리 스트링이 되는 값을 지정 - URL에 쿼리 스트링으로 추가된다. addFlashAttribute( 키, 값 ) - 일회용으로 데이터를 전달하고 삭제되는 값을 지정 - URL에 보이지는 않지만 JSP에서 일회용으로 사용가능 ✔ RedirectAttributes 예시 👉testcontroller @GetMapping("/test01") public String test01(RedirectAttributes redirectAttributes) { ..