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
How does response sendredirect work?
Explain lifecycle methods.
What do cookies mean?
What jsp lifecycle methods can be overridden?
What is taglib uri in jsp?
What program opens a jsp file?
What is expression language in jsp?
Can we use jstl in html?
What is jsp tag?
What is pagecontext?
Tell us about the jsp life cycle methods.
How do you pass control from one jsp page to another?
Why are jsp pages the preferred api for creating a web-based client program?
How to restrict page errors display in a JSP page?
What are the lifecycle phases of a jsp?