Thursday, October 7, 2010

How to get session in any servlet?

How to get session in any servlet?
Ans:Here is two way to get the session in servlet
1-This common and most used technique in servlet.
  using request object
  HttpSession=request.getSession();
2-second is get from the session event object.
  HttpSessionEvent has getSession
  Suppose if you create any Listener class which is implement the HttpSessionListener Interface then you could get the session object