Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do you need false for getSession()

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that creates a session object, if you set the parameter to true if there is no existing session it will create one.

I then call another page which calls session again with parameter again set to true it loads the exsiting session.

With false it returns null if there is no existing session otherwise it loads the exsiting session.

So both load an existing session, isnt one supposed to create a new session.

Thanks for any feed back Tony
 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked it out you add the parameter false only to check if there is a existing session if it does not return null you call Session.invalidate() method.

Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic