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


Please Help Members By Posting Answers For Below Questions

How does jsp engines instantiate tag handler classes instances?

628


write a program in javasacript to shake the window

2634


What are page directives?

703


What is the difference between jsp and php?

637


How can we use beans in jsp?

660






What are the jsp tag?

725


How do I run a jsp file in linux?

703


What is server context?

663


What is the difference between "JTable" and "JTGrid"? can they be used interchangeably?

1954


What is the jspinit() method?

672


Explain the action?

771


What are jsp and servlets?

651


How can we disable el?

675


What is content type in jsp?

644


How can we forward the request from jsp page to the servlet?

691