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

What are different ways for authentication of servlet?

529


Which exception is thrown if the servlet is not initialized properly?

590


What is the use of servletconfig interface?

557


Name the different ways of session tracking.

569


Explain the concept of ssi ?

595






what do you understand by url rewriting?

548


What is http servlet? Explain with the help of an example.

581


Explain session tracking and its importance?

546


What are advantages of servlets over cgi?

632


Is servlet a server side scripting language?

553


What is session?

643


How does tomcat servlet container work?

592


What is a web application and what is it’s directory structure?

585


What is the difference between genericservlet and httpservlet

588


What is life cycle of Servlet?

605