- Mastering Spring 5.0
- Ranga Rao Karanam
- 83字
- 2021-07-02 22:12:17
Session attributes
All the attributes and values that we discussed until now are used within a single request. However, there might be values such as a specific web user configuration that might not change across requests. These kinds of values will typically be stored in an HTTP session. Spring MVC provides a simple type level (class level) annotation @SessionAttributes to specify the attributes that would be stored in the session.
Take a look at the following example:
@Controller
@SessionAttributes("exampleSessionAttribute")
public class LoginController {