File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Session handling in Spring" Watch "Session handling in Spring" New topic

Session handling in Spring

fu bace

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
author & internet detective

Joined: May 26, 2003
Posts: 33102

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

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
fu bace

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

A simple but a good example can be found here.
I agree. Here's the link:
subject: Session handling in Spring
jQuery in Action, 3rd edition