Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Jeanne Boyarsky
Liutauras Vilda
Sheriffs:
Tim Cooke
Bear Bibeault
paul wheaton
Saloon Keepers:
Carey Brown
Stephan van Hulst
Tim Holloway
Mikalai Zaikin
Piet Souris
Bartenders:
Forum:
Struts
Better way to check user session
Erap Estrada
Ranch Hand
Posts: 92
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello guys, I just wonder if there's a better way to check if the user is logged in and has a valid session.
Normally, I do this on my Action class:
Account account = (Account)request.getSession().getAttribute("user"); if(account != null){ // process stuff and forward user to right page }else{ //forward user to log-in page and tell them their session has expired. }
Now, I wonder if there's a way to do it dynamically like how
Struts
do it in form validation. Just set it on xml file and good to go.
Thank you in advance.
SCJP with 98% by...
Craig Bayley
Ranch Hand
Posts: 46
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Implement a Filter.
Navi Lock
Ranch Hand
Posts: 39
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Craig,
Could you elaborate please ..
A code snippet would be great.
Thanks,
-Navi
Erap Estrada
Ranch Hand
Posts: 92
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
what kind of filter? Thank you!
SCJP with 98% by...
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Browsing with the back button
Load objects on session upon restart
Checking to see if a session has expired
Throwing server errors
Redirection after session Timeout.
More...