File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes best way to implement session handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "best way to implement session handling" Watch "best way to implement session handling" New topic

best way to implement session handling

ankurshah shah

Joined: Aug 27, 2009
Posts: 2

I am developing an application in struts 2 and i want to know what is the best way to implement session handling.

There is a login page in which when i login i get acess to various pages like add, remove, etc.
If user tries to access this pages without login or if session has expired he should be redirected to login page.
What should i do to implement this?
should i use normal cookies check on all pages or should i use interceptor for this or is there any other better way. (session handling)
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi ankurshah,
i think interceptor would be the better option for you, because adding checks on each page would be cumbersome,so its better that you implement a login interceptor and reference it as default interceptor for the actions in struts.xml. this will redirect any unauthorised user to the login page. If you have any query let me know.


Good luck!!
A small leak can sink a Gigantic ship.>
I agree. Here's the link:
subject: best way to implement session handling
It's not a secret anymore!