Matt Skeens wrote:
> I seem to be having a problem with session.putValue. Here is the line in
> question:
>
> session.putValue (session.getId(), username);
>
> Username is a string. As soon as I hit that line, the servlet just stalls.
> If I comment out that line, the servlet just cruises right through. Any
> ideas is appreciated.
>
> I'm using an older version of jserv (1.0b3). Could that be the problem?
>
> Matt Skeens
> XNet Information Systems
> [EMAIL PROTECTED]
>
I'm not sure why the servlet might be "stalling", but I do have a question --
why would you be trying to use the session ID itself as a key to store things
with?
Think of session management as having a private Hashtable per session (such
as, per logged-in user). This lets you use keys that are human
understandable, but still be separate per user. I would tend to code your
example line above like this:
session.putValue("USERNAME", username);
so that this value can be retrieved (later in the same servlet, or in another
servlet accessed within the same session) like this:
String username = (String) session.getValue("USERNAME");
You can use any key you want, with any object type, just like you can with a
Hashtable.
Craig McClanahan
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]