Skip to content

RedirectAttributes와 리다이렉션 #8

Description

@dev-xong
 @GetMapping("/ex5")
    public String ex5(RedirectAttributes redirectAttributes){

        redirectAttributes.addAttribute("name", "ABC");
        redirectAttributes.addFlashAttribute("result", "success");

        return "redirect:/ex6";
    }

    @GetMapping("/ex6")
    public void ex6(){

    }
redirectAttributes.addAttribute("name", "ABC");

name 데이터는 쿼리 스트링으로 전달 name=ABC

redirectAttributes.addFlashAttribute("result", "success");

일회용으로 사용되므로 새로고침하면 result 변수는 더이상 jsp에서 보이지 않음

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions