Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getsession(false)

 
sri rallapalli
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.
 
Ali Gohar
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic