aspose file tools*
The moose likes Servlets and the fly likes Doubt  on session() and session(false) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt  on session() and session(false)" Watch "Doubt  on session() and session(false)" New topic
Author

Doubt on session() and session(false)

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi All,


HttpSession session=request.getSession(true); this will create new session

and HttpSession session=request.getSession(false); this will maintain existing session right?


if yes, i should get out put like
-------------------------------------------
EXISTING SESSION 1ST SESSION

NEW SESSION [empty]


-------------------------------------------

but i am getting:
---------------------------------------
EXISTING SESSION 1ST SESSION
NEW SESSION 1ST SESSION
---------------------------------
please explain me . Hope you understand my point

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42933
    
  68

HttpSession session=request.getSession(true);

this will create new session

Not necessarily. If a session exists already, it will return that one. The first paragraph of the javadocs of getSession(boolean) mentions this.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

I GOT IT ULF.THANK YOU SOMUCH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on session() and session(false)