@Target(value=TYPE) @Retention(value=RUNTIME) @Inherited @Documented public @interface SessionAttributes
NOTE: Session attributes as indicated using this annotation correspond to a specific handler's model attributes, getting transparently stored in a conversational session. Those attributes will be removed once the handler indicates completion of its conversational session. Therefore, use this facility for such conversational attributes which are supposed to be stored in the session temporarily during the course of a specific handler's conversation.
For permanent session attributes, e.g. a user authentication object,
use the traditional session.setAttribute
method instead.
Alternatively, consider using the attribute management capabilities of the
generic WebRequest
interface.
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.
Modifier and Type | Optional Element and Description |
---|---|
Class[] |
types
The types of session attributes in the model, to be stored in the
session or some conversational storage.
|
String[] |
value
The names of session attributes in the model, to be stored in the
session or some conversational storage.
|
public abstract String[] value
Note: This indicates the model attribute names. The session attribute names may or may not match the model attribute names; applications should not rely on the session attribute names but rather operate on the model only.
public abstract Class[] types