Annotation Interface SessionAttribute
The main motivation is to provide convenient access to existing, permanent session attributes (e.g. user authentication object) with an optional/required check and a cast to the target method parameter type.
For use cases that require adding or removing session attributes consider
injecting cn.taketoday.web.session.WebSession or
jakarta.servlet.http.HttpSession into the controller method.
For temporary storage of model attributes in the session as part of the
workflow for a controller, consider using SessionAttributes instead.
- 从以下版本开始:
- 2018-08-21 20:19
- 作者:
- Harry Yang
- 另请参阅:
-
可选元素概要
可选元素
-
元素详细资料
-
value
Alias forname().- 默认值:
- ""
-
name
The name of the session attribute to bind to.The default name is inferred from the method parameter name.
- 默认值:
- ""
-
required
boolean requiredWhether the session attribute is required.Defaults to
true, leading to an exception being thrown if the attribute is missing in the session or there is no session. Switch this tofalseif you prefer anullor Java 8java.util.Optionalif the attribute doesn't exist.- 默认值:
- true
-