How we can check in particular page the session will be
alive or not
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is Servlet API used for connecting database?
Why do we have servlet filters?
What is servlet initializer?
How can you push data from an Applet to a Servlet?
Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file?
Can we fetch the attributes related to a servlet on a different servlet?
when the jsp page is translated to servlet?
Which application server is best for java?
Define the lifecycle for executing a jsp page.
When we don't write any constructor for the servlet, how does container create an instance of servlet?
What do you understand by mime type?
How do you find out what client machine is making a request to your servlet