This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes HttpSession() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSession()" Watch "HttpSession()" New topic


Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
If we use

HttpSession session=request.getSession();

Then it will return the new session whether there is any other pre-existing session or not.

If i do

HttpSession session=request.getSession(false)

then itwill return either null or the pre-existing session.

I suppose.
Please comment whether i am right or not...................
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The first place I would go to check this is the API:

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: HttpSession()
It's not a secret anymore!