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


Please Help Members By Posting Answers For Below Questions

Explain the methods of request dispatcher in servlet?

515


Explain the difference between a web server and a web container?

513


Can you refresh servlet in client and server-side automatically?

614


Why do we use sendredirect() method?

546


How to get the path of servlet in the server?

532






Explain servlet.

566


What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?

613


How can the session in servlet can be destroyed?

707


Explain mvc pattern.

592


What is the difference between jsp and servlet life cycle?

685


What is life cycle of Servlet?

605


What’s the use of the servlet wrapper classes??

638


Define the life cycle of a servlets.

570


How can we refresh automatically when new data is entered into the database?

595


What is difference between PrintWriter and ServletOutputStream?

768