File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes why do you need false for getSession() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "why do you need false for getSession()" Watch "why do you need false for getSession()" New topic
Author

why do you need false for getSession()

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
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

Joined: Jun 29, 2002
Posts: 573
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do you need false for getSession()
 
Similar Threads
Problems with sessions
The Session
Please explain me
Doubt on session() and session(false)
Session