This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Sessions 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 "Sessions" Watch "Sessions" New topic


Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
I'm using HttpSession objects for an on-line form
HttpSession session = request.getSession(true);
session.setAttribute("test", test);
Where the attribute "test" is a javabean that stores all of the data associated with the session. During each subsequent request(or step), I do the getSession method-if its new-I invalidate the session. And I also use the following method to get the bean:
TestSql test = (TestSql)session.getAttribute("test");
I use a request dispatcher to forward to a jsp page. The jsp page uses
<jsp:useBean id="test" class="TestSql" scope="session"/>
and uses data from the bean. My question is ---- am I tracking sessions properly- I mean- should I use URL-rewriting or hidden fields to generate and store session id's to identify them to the server. I've had no problems so far(all of the data has been correct), but I'm wondering if I still need to implement a session tracking mechanism in addition to the java bean attributes.Thanks in advance.
I agree. Here's the link:
subject: Sessions
Similar Threads
using request scope during pagination
Losing session between different web apps.
warn the user before session timeout & login back when session time out is over
session stuff
Head First Servlets & JSP book - Reader Question