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
What is the difference between context parameter and context attribute?
What is called Scriptlet?
What is Request Dispatcher?
What is servlet configuration?
Differentiate between get and post?
How to get the path of servlet in the server?
What’s the difference between forward() and sendredirect() methods?
Can we use the constructor, instead of init(), to initialize servlet?
Why do we have servlet wrapper classes?
Write a hello world program using servlets.
Why is http protocol called as a stateless protocol?
What is servlet attributes and their scope?
What is the major difference between context parameter and context attribute?
What is difference between PrintWriter and ServletOutputStream?
How the typical servlet code look like ?