>question is, why do I start with null again whenever I close and reopen
> >the Web browser (even though the session keeps track of how many times >
>I had visited the page before newly opening the browser)?

Session is NOT specific to a computer but its specific to a browser
instance. When you open the browser your session starts, for every new
browser you open, it opens a new session.

NOW it gets tricker, if you open a new browser from within your current
browser your new broswer shares the same session as the parent broswer,
since to the outside world these broswers share the same id....

HOWEVER, there is an exception to this rule, in some browsers you can change
the behavior of the newly open browser to start in a new id rather than bask
within their parent broswers id.
(I forget the exact setting since the default is for a child broswer to
reside using the parent broswers id... however IN one buggy version of
ie4.01 of NT this behavior was switched, )

OF Course this is if you are using session by cookie, the default choice,
IF you use session by url rewriting, then, these behaviors will change
slightly (I Suspect, I don't use the url rewriting session management
method, so I havent needed to test all the ramifications of this method
yet.)

NOW on your second mystery...

Not quite sure whats happening there, don't have enough info to judge.


Hope this helps

Casey Kochmer
[EMAIL PROTECTED]
www.jspinsider.com



>From: Barry Burd <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Behavior of the implicit session object?
>Date: Thu, 10 Aug 2000 19:54:09 -0400
>
>I thought I understood the JSP session object, but then I observed the
>following behavior. The code that I'm executing is
>
><br>Attributes:<br>
><%! int count=1; %>
><%= session.getMaxInactiveInterval() %> <br>
><b><%= session.getAttribute("numVisits") %></b>
><% session.setAttribute("numVisits", Integer.toString(count++)); %>
>
>When I open my Web browser, and visit this page, I get
>
>Attributes:
>1800
>null
>
>Then, when I click Refresh, I get
>
>Attributes:
>1800
>17
>
>The reason for the number 17 is because I had visited this page sixteen
>with the same Browser before closing and reopening the browser. So my first
>question is, why do I start with null again whenever I close and reopen the
>Web browser (even though the session keeps track of how many times I had
>visited the page before newly opening the browser)?
>
>The second question relates to the visiting of the page from a different
>computer. I go to another computer on the same LAN. (Call this other
>computer "computer B".) I visit the same jsp page using computer B. First
>I get the null value, then 2, then 3, then 4. OK - that's what I'd expect.
>But then, I go back to the original computer (the one on which I counted
>up to 17) and I open my Web browser on that computer once again. This time,
>I start out with the value null, but then get the value 5 (the number that
>I stopped at when I walked away from computer B). Shouldn't both computers
>maintain their own places in the numbering, since a session is specific
>to a single computer? That is, when I go back to the original computer,
>shouldn't the numbers start from 18, where I left off before?
>
>Thanks.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to