Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

getsession(false)  RSS feed

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

getSession(false), is returning an existing session and null if nothing is available, if that is the case, then creating a session in normail way, i.e.
HttpSession session = request.getSession();
HttpSession session = request.getSession(true);
in both the above ways, it is always creating a new session, so if we call isNew() on the session object then we should always get true, and if its always true, then how can we maintain session?

Regards,
Sri.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

in both the above ways, it is always creating a new session



No, request.getSession() will first check if its existing session, then it will return that otherwise will create new one.
[ March 21, 2007: Message edited by: Ali Gohar ]
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!