Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 response sendredirect work?

928


Explain lifecycle methods.

1009


What do cookies mean?

839


What jsp lifecycle methods can be overridden?

956


What is taglib uri in jsp?

917


What program opens a jsp file?

1005


What is expression language in jsp?

979


Can we use jstl in html?

866


What is jsp tag?

857


What is pagecontext?

982


Tell us about the jsp life cycle methods.

918


How do you pass control from one jsp page to another?

896


Why are jsp pages the preferred api for creating a web-based client program?

1035


How to restrict page errors display in a JSP page?

974


What are the lifecycle phases of a jsp?

1009