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.

1 comment :

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.