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 use of?
What is the purpose of
Why are jsp pages preferred for creating web-based client program?
How do I save a jsp file?
What do you know about jsp tags?
How to pass information from jsp to included jsp?
How is scripting disabled?
What is expression language injection?
What is session tracking in jsp?
How can we retrieve warnings?
How to run java program in jsp page?
What is the use of requestdispatcher?
What is jsp language?
How are the jsp requests handled?
Where is jsp used?