Win a copy of Svelte and Sapper in Action this week in the JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HttpSession question

 
Ranch Hand
Posts: 220
Eclipse IDE Spring Java
  • 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...
 
Author
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 Spring Java
  • 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 ...
 
    Bookmark Topic Watch Topic
  • New Topic