File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session handling in Spring

 
fu bace
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Spring, you would use an interceptor. In other MVC frameworks (or no framework), you'd likely use a filter.
 
fu bace
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic