*
The moose likes Servlets and the fly likes Head First Session management : doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Head First Session management : doubts" Watch "Head First Session management : doubts" New topic
Author

Head First Session management : doubts

swati soni
Greenhorn

Joined: Aug 16, 2009
Posts: 12
I have doubts about httpsession

1. We know that request and response objects are lost as soon as a response is dispatched to client.

We get a http session from :


HttpSession session = request.getSession();

out.println("<a href=\""+response.encodeURL("DogListener")+"\">click me </a>"); ... (1)

Case 1: I turned off the cookies for my brower.
When I click on the url It displays a Blank page.

case 2: When I enabled cookies for my brower . It displayed result of DogListener.I worked as expected.

According to Head first servlets and jsp (1) must work as mentioned in book.
What is wrong with my application.

What I couldnot understand is :

If response Object is lost after response is dispatched ,How can a HttpSession corresponding to that Request and response can live.

Alright fine it lives even after the response is send back. Where it is stored.How does the container keeps track of it.

I really need to understand this concept.

Please provide explination.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Of course they are stored in session object in server. Container keeps track of session using Session Ids (which is sane as passed between browser and server). Imagine a Hashtable having session ID as key and HttpSession object as value. its similar to that. Though its not necessary to know the internal workings of container. When you maintain session table ( incase you maintain session at application level) , this is one such way to implement it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Session management : doubts
 
Similar Threads
Session management ambiguity
why Not encodeDispatchURL ????
Session Management
Session
Chapter 6(Session Management) notes (HFSJ) for revision