• Post Reply Bookmark Topic Watch Topic
  • New Topic

Qestions regarding sessions

 
Ashish K Sharma
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) How do i know weather a session exists or not?
what i know is that i can call request.getSession(false), if it gives me null session already exists? Is there any other way?

2) whenever a session is invalidated i want to perform some special functionality, inside which method can i perform these actions?

Ashish
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i know is that i can call request.getSession(false), if it gives me null session already exists? Is there any other way?



if it gives null means no session exists...


whenever a session is invalidated i want to perform some special functionality, inside which method can i perform these actions?


Call a user defined function (which has your functionality) after you invalidate the session..

Regards
[ February 18, 2007: Message edited by: A Kumar ]
 
Ashish K Sharma
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For second point,
say my session gets invalidated from DD, via session-timeout element, how can i call my user defined method then?
Isn't there some standard way to perform this??

Ashish
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably you can make use of the listeners
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems as if you are not familiar with the basic services that a servlet container provides (such as session listeners).

You need to grab a copy of the Servlet Specification and read it from cover to cover. It's an easy read, and even if you don't grasp every nuance on the first reading, it will give you an overview of the mechanisms that are available to you as a servlet author.

Writing servlets without having read the Specification is just plain doing it wrong.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!