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 does jsp mean in text?
What is the use of jstl?
What is meant by implicit objects and what are they?
How do I use comments within a jsp page?
Explain the various scope values for
Explain what is jsp ?
What is the need of jsp?
Java Server Page I can use a function in two ways:
Either I declare
What are the steps involved in reading data from a form using jsp?
What is scriptlet tag in jsp?
Why jsp and servlets are used?
Why are the request.getrequestdispatcher() and context.getrequestdispatcher() used?
How do you connect to the database from jsp?
Is jsp server side or client side?
What are different types of comments used in jsp?