Q : In session created by server with client(browser) How
can server find that request coming is belong to new
session OR belong to session that is timeout.
Answer Posted / subhash
getSession() returns a session regardless of there's apre-
existing session.Since we always get back an HttpSession
instance back from the method,the only way to know if the
session is new is to ask the session itself:
HttpSession session=request.getsession();
if(Session.isNew())
{
out.println("A NEW SESSION");
}
else
{
out.println("WelCOme Back");
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the jsp?
What are directives in jsp?
How we can use javascript with jsp pages?
What is jsp expression language and what are it’s benefits?
Explain translation phase.
How do you comment out in jsp?
what is the extended star schema
Why do we need custom tags in jsp?
Explain the uses of
What are the differences between get and load methods?
How can we stop errors on display in a jsp page?
Can I stop jsp execution while in the midst of processing a request?
How can I prevent direct access to a jsp page from a browser?
What is the default value of session attribute in jsp?
How can I prevent the output of my jsp or servlet pages from being cached by the browser?