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

HttpSession question

 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why the above code didn't print session is new when I call it every time ?
I observe that it print only one time ?

isn't it suppose to open a new session when I request it...

Thanks...
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, not on every request! getSession(true) will return the existing session if one exists, or a new session only if one does not already exist. Compare with getSession(false) which returns the existing session if one exists, or null if one does not already exist.
 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Charles Lyons:
No, not on every request! getSession(true) will return the existing session if one exists, or a new session only if one does not already exist. Compare with getSession(false) which returns the existing session if one exists, or null if one does not already exist.






okay then I changed my code like that and everytime it gave me a new session

Thank you for your response I got it ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic