Link to home
Start Free TrialLog in
Avatar of getravi2k
getravi2k

asked on

Where is "session" stored? is it in the browser or at server..

HI,

I was somewhat confused with the session Object.
From this experiment.
created 2 jsps.
a) test.jsp
b) test1.jsp

In the test.jsp
<%
session.setAttribute("test", "Ravi");
%>

in the test1.jsp
<%
      System.out.print(session.getAttribute("test"));
%>

So in the first jsp.. you are storing the attribute "test" and in the second jsp you are retrieving and displaying the value.

Now after setting the attribute.. Plz restart the application server.  
Now try directly try for the test1.jsp using the same browser.

You will see the value "Ravi" displaying on the console.
I am confused...  so i guess the session is stored at the browser side.

Am i correct? or can somebody explain why?

Regs,
Ravindra N
Avatar of getravi2k
getravi2k

ASKER

hi
Session cookie is stored at client side.

Based on ID from that cookie server retrieves the valuse of session from memory/database etc.

So basically session data is stored at server but session identifier is stored at client.
ASKER CERTIFIED SOLUTION
Avatar of drazen_nikolic
drazen_nikolic
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool. thnx a lot for the clarification.