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

What is a expression?

528


Explain the difference between include directive and include action in jsp?

512


What is difference between java and jsp?

470


Is jsp technology extensible?

652


Which package does a jsp api consist of?

485






How do I use comments within a jsp page?

539


How clear chache and buffer of opera browser.

1930


How can we stop errors on display in a jsp page?

509


What is a scriptlet?

508


Explain jsp technology?

521


What are the steps for creating custom tags in jsp?

501


Why does jcomponent have add() and remove() methods but the component does not?

473


What is scriptlet tag in jsp?

480


Is jsp static or dynamic?

485


Is jsp front end or backend?

496