Search code examples
javaspring-mvcstruts-1

How to manage user session in Spring MVC


I am migrating java struts 1.1 application to Spring MVC. I have a question about how to handle user session, multiple users concurrently can log in and use this application. Which is normal for any application. Do I need to take care of anything specifically to manage user sessions just to make sure one user's activity should not be updating other user's activity/data. I will be using the bean scopes as it is in spring mvc style.

Any suggestions on this please?

Kiran


Solution

  • Spring MVC just like Struts are based on Servlets and need to handle user session the same way. You can access HttpSession in Spring Controller using RequestContextHolder or just declare it as parameter in your controller method.