This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes getSession(false); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getSession(false);" Watch "getSession(false);" New topic
Author

getSession(false);

Vipul Gulhane
Greenhorn

Joined: Mar 28, 2011
Posts: 20
What happen if I did Like this

HttpSession ses=resquest.getSession(false);
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

returns the session obj if the session is valid, else you will get null
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32635
    
215

What do you mean? You get a reference to the session if it exists. But that's in the JavaDoc so I'm guessing you are asking something more specific.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
bagaria kushal
Greenhorn

Joined: Mar 29, 2011
Posts: 19
This will check whether Session already existed for the request or not. If it existed then it will return the already existed Session. If Session is not already existed for this request then this method will return NULL, that means this method says that the request does not have a Session previously
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getSession(false);
 
It's not a secret anymore!