• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session Management

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I use struts 1.1 , WL8 and Win2000.

Can anybody explain how exactly you would stop user accessing the information once he has logged out ?

I know that you can do session.invalidate(). but it doesn't work for me or I don't know how exactly to use it.

Could anybody explain little bit and give example for this ?

Thanks
-Anand.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question really belongs more in the servlet list than the Struts list because it involves the standard API, rather than anything specific to Struts.

Here's a stab at an answer, however.

When a user logs out, you get his current HttpSession and call the invalidate() method on it.

If you want to check to see whether a user is currently logged on and has a session before letting her do anything, put the following code near the beginning of each action:



if you pass the false parameter to the getSession() method, it will not create a session if one does not exist. That's how you can tell if the user has one or not.

Merrill
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic