How we can check in particular page the session will be
alive or not

Answers were Sorted based on User's Feedback



How we can check in particular page the session will be alive or not..

Answer / 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

How we can check in particular page the session will be alive or not..

Answer / aseet padhi

U can use request.getSession(false); method in
HttpServletRequest interface.It returns the HttpSession
associated with this request or null if the request has no
valid session.

Is This Answer Correct ?    10 Yes 3 No

How we can check in particular page the session will be alive or not..

Answer / pratyusha

is alive()

Is This Answer Correct ?    4 Yes 8 No

How we can check in particular page the session will be alive or not..

Answer / venkata rao g

Hi ,
I think is alive() is the method of the thread.
iam assuming it is correct "if the page will be there for a
specified amount of time or until the browser will be
closed or until the user log's out" the session is there.


if u have the better solution plz send to my mail id

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More Servlets Interview Questions

can anybody send me j2ee softwares such as tomcat,weblogic server ,netbeans

2 Answers  


why are using HttpServlet in realtime projects and why are not using Genericservlet

2 Answers  


What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext?

2 Answers  


What are the functions of the servlet container?

0 Answers  


What is dispatcher servlet?

0 Answers  






Is Servlet Class Thread safe?????? How to make servlet Thread safe ???

4 Answers   Cognizant,


what are the way a client can be tracked?

3 Answers   ABC, IBM,


How httpservlet is different from the genericservlet?

0 Answers  


how the jsp page can be regenerated?

2 Answers   HCL,


when the jsp page is translated to servlet?

5 Answers   HCL,


can i call destroy() method in init() method of servlet

9 Answers   Ericsson, IBM,


Why servlet is mostly used?

0 Answers  


Categories