This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 30130
    
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session handling in Spring
 
Similar Threads
Spring MVC @SessionAttributes - lifespan? Documentation about it?
Controlling Hibernate Session with Spring
Spring : how to redirect to login page on session timeout
[Spring 2] Sample With transactions
authenication user using spring security