'쉽게 따라하는 자바 웹개발'의 p.138을 정리하면, @SessionAttributes의 정의를 이렇게 내릴 수 있다. 빈에서 @SessionAttributes("애트리뷰트명")로 선언하면, 해당 애트리뷰트명으로 Model에 어떤 값이 들어가면 그 값(객체)을 세션에 담아둔다. 언제까지? 그 세션에 담아둔 객체를 비울 때 (complete)때까지.
아래는 스프링 reference에 있는 @SessionAttributes 정의다.
15.3.2.9 Specifying attributes to store in a session with @SessionAttributes
The type-level
@SessionAttributes
annotation declares session attributes used by a specific handler. This will typically list the names of model attributes or types of model attributes which should be transparently stored in the session or some conversational storage, serving as form-backing beans between subsequent requests.
The following code snippet shows the usage of this annotation, specifying the model attribute name:
다음의 코드정보는 이 애노테이션의 사용이 모델 애트리뷰트명을 지칭하는 것을 보여준다.
@Controller @RequestMapping("/editPet.do") @SessionAttributes("pet") public class EditPetForm { // ... }
![]() | Note |
---|---|
When using controller interfaces (e.g. for AOP proxying), make sure to consistently put all your mapping annotations - such as
@RequestMapping and @SessionAttributes - on the controller interface rather than on the implementation class. |
댓글 없음 :
댓글 쓰기