Spring SessionAttributes or httpsession

643 Views Asked by At

In my Spring MVC project I have a jsp page , registration page , in which there is a form. In this form the user inserts his data (name, surname and so on).I created a bean User and I bound the form with this bean.But now I have a problem.How can i put the user object into a session in a method of a controller? Can I use @SessionAttributes,httpsession or I set the scope of the bean to session? How can i solve it?Sorry for my English. Thanks

1

There are 1 best solutions below

6
On BEST ANSWER

You can use HttpSession so just need to set your user object in your session and access anywhere into the system.

Refer this httpsession documentation for setting session value.