Using session attributes

All of the attributes and values that have we discussed hitherto are used within a single request. However, there may 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. 

You need to set both request scoped and session scoped attributes to your model. Session scoped attributes are marked with the @SessionAttributes annotation.

Take a look at the following example:

    @Controller 
@SessionAttributes("exampleSessionAttribute")
public class LoginController {

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset