wood burning stoves 2.0*
The moose likes Spring and the fly likes Session handling in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Session handling in Spring" Watch "Session handling in Spring" New topic
Author

Session handling in Spring

fu bace
Greenhorn

Joined: Oct 16, 2009
Posts: 24
Hi. I have a question about user session handling in Spring or any Mvc.

For example when user succesfully logins to site i will set a session to this user which helps me to understand whether the user is logged or not.
The question is where can i do this session check operation. Checking the session attribute in every Controller sounds like funny. So what is the best way to handle users sessions in Spring.

Thanks for any help.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

In Spring, you would use an interceptor. In other MVC frameworks (or no framework), you'd likely use a filter.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
fu bace
Greenhorn

Joined: Oct 16, 2009
Posts: 24
Thanks for pointing.

A simple but a good example can be found here.

http://spidercatch.blogspot.com/2009/02/interceptors-in-spring-and-struts-2.html
 
 
subject: Session handling in Spring