How we can check in particular page the session will be
alive or not
Answer Posted / ruchi
when we create session , we write
HttpSession session= res.getSessionn(true);
this checks whether there is a session bind on associated
request.if yes then it returns reference to session
object,otherwise create a session for associated request.
but if we want check that session is alive or not then we
write
HttpSession session= res.getSessionn(false);
this checks whether there is a session bind on associated
request.if yes then it returns reference to session
object,otherwise it returns null reference.
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
Why are servlets used?
Why is a constructor needed in a servlet even if we use the init method?
List some life cycle methods of a servlet.
What are the steps that are involved in using the httpservlet class?
What are the steps involved in placing a servlet within a package?
What is a servlet engine?
Why the container loads server at the application startup and how?
What is servlet looping or chaining?
What is the major difference between context parameter and context attribute?
How to rectify errors in java servlet while compilation?
How can you create a session in servlet?
How is an application exception handling is done using a servlet?
What do you mean by httpservlet and how it is different from the genericservlet?
What are the new features added to servlet 2.5?
What is the use of java servlet api?