• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on session() and session(false)

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


HttpSession session=request.getSession(true); this will create new session

and HttpSession session=request.getSession(false); this will maintain existing session right?


if yes, i should get out put like
-------------------------------------------
EXISTING SESSION 1ST SESSION

NEW SESSION [empty]


-------------------------------------------

but i am getting:
---------------------------------------
EXISTING SESSION 1ST SESSION
NEW SESSION 1ST SESSION
---------------------------------
please explain me . Hope you understand my point

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

HttpSession session=request.getSession(true);

this will create new session

Not necessarily. If a session exists already, it will return that one. The first paragraph of the javadocs of getSession(boolean) mentions this.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I GOT IT ULF.THANK YOU SOMUCH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic