이전 서블릿

request scope

session scope

application scope

 

 


 

 

스프링

request scope

flash scope   ==========⇒   redirect 했는데 target에서 값을 딱 한번만 사용할 수 있다.

session scope

application scope

 

💡 기존 redirect 에서는 Model의 값을 tartget 사용 못 함

@RequestMapping("/aaa")
m.addAttribute(key,value);
return "redirect:target";
}

 

 

 


 

 

flash scope의 redirect

⇒ RedirectAttributes 값을 target 사용 가능

 

public String xxx(RedirectAttributes m) {

      m.addFlashAttribute(key,value);

      return “redirect:target”;

}

 

 

 

flash scope 활성화

servlet-context.xml 에서

<mvc:annotation-driven /> 추가 (mvc Namespace 추가)

 

 

 


 

 

 

 

 

 

 

'Framework > SPRING FRAMEWORK' 카테고리의 다른 글

로그아웃 (로그인체크확인)  (0) 2023.09.18
로그인 처리  (0) 2023.09.18
forward / redirect  (0) 2023.09.15
Controller 클래스 메서드의 리턴타입  (0) 2023.09.15
모델 생성후 3가지 scope에 저장  (0) 2023.09.15
xoo | 수진