The HttpSession object

HttpSession object is used to store the session data from  servlet you are written.
Firstly it obtains a session object, read or write the session object and lastly invalidate the session object. It uses the session ID to track the request from client to the server.
Methods used in HttpSession
  • isNew():It will return true if the client doesn't know about the session.
  • getId() : It will returns a string containing a unique identifier assigned to this session.
  • setAttribute() : It is used to store an object to this session
  • getAttribute() : It returns the object those stored  in this session.
  • setMaxInactiveInterval() : It is used to calculate the time between client request and before invalid the session
  • invalidate() : It is used to invalidate the session which are stored.

0 comments :

Post a Comment