Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

where is HttpSession.setAttribute stored?

843841Oct 6 2004 — edited Oct 6 2004
I have a jsp that keeps count and is storing the info in a HttpSession object using the setAttribute method(The code is at the bottom). How does the server know I am the same client is before? I am just using http which is stateless. I also don't see any cookies transferring the data back. If I close and reopen, my browser, the incrementing starts all over again. Thanks for helping me understand this better.
dean
<%@ page errorPage="errorpage.jsp" %><html>  <head>    <title>Session Example</title>  </head>  <body>    <%      // get a reference to the current count from the session      Integer count = (Integer)session.getAttribute("COUNT");            if ( count == null ) {              // If the count was not found create one        count = new Integer(1);        // and add it to the HttpSession        session.setAttribute("COUNT", count);      }      else {         // Otherwise increment the value        count = new Integer(count.intValue() + 1);        session.setAttribute("COUNT", count);      }        out.println("<b>You have accessed this page: "        + count + " times.</b>");    %>  </body></html>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2004
Added on Oct 6 2004
5 comments
698 views