Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Getting HttpSession object from SessionContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting HttpSession object from SessionContext" Watch "Getting HttpSession object from SessionContext" New topic
Author

Getting HttpSession object from SessionContext

Ravissant Markandey
Ranch Hand

Joined: Oct 24, 2007
Posts: 41
Hi Everyone,

Can anyone tell me how i can get the HttpSession object from session context??

Also i dont even have the session id so context.getSession(sessionId) is ruled out.

Thanks,
Ravissant
[ November 20, 2008: Message edited by: Ravissant Markandey ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you're talking about the HttpSessionContext it's been deprecated so I wouldn't write code that uses it now.

Even if it weren't deprecated, there is no way to get a reference to a specific session object without having its ID.

Maybe if you tell us a little more about what it is that you're trying to accomplish, someone can suggest another approach.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ou yang
Greenhorn

Joined: Oct 14, 2008
Posts: 10
I agree with ben's points.the specific session object has no ID.it is used to rewrite the URL and you can store the variable parameter in the session scope.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by ou yang:
I agree with ben's points.the specific session object has no ID.it is used to rewrite the URL and you can store the variable parameter in the session scope.


Sessions do have IDs.
In this case the OP (Original Poster) was asking about retrieving a reference to the session without knowing its ID.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting HttpSession object from SessionContext
 
Similar Threads
sessions
session management
How to pass HttpSession to SessionBean?
some help
scope