In your situation, you probably don't want to mess around with the
HttpSession object.  The session object is designed for sharing info
within the same session, not the same user.  If sharing info among
multiple sessions is desired, use ServletContext instead.  One solution
would be store your user-specific application data as an attribute and
store it in the servlet context, with the user id as the key.  You may
need to use a hashtable or your own data structure as the context
attribute if dealing with multiple/complex data types.  This solution
will also allow user data to be accessible even after one of the user
sessions is terminated.

ND 

-----Original Message-----
From: Daniel Guggi [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 16, 2006 8:22 AM
To: users@tomcat.apache.org
Subject: Multiple Sessions per user

Hi!

I ran into a session-issue with a webapp. There are situations when it
would be nice for a user (same browser/same machine/same webapp) to have
the possibility to login twice and thus have two different JSESSIONIDs.

There is also a problem if the user opens a second browser-window or
-tab, because the user may change session-data in the one window and
thus will have invalid (outdated) data in the other window afterwards.

Example:
The user is logged and requests a jsp page that has the following
session-bean:
<jsp:useBean id="someBean" scope="session" class="someClass" />

The user also opens the jsp page in another browser-window (or -tab).
Now he starts editing the data (provided in the form) in one of those 
windows and then submits it to the server. The server verifies and
stores
the data in db. As a result the session-variable "someBean" gets
reloaded/updated.

If the user now tries to update the data in the other window, there will
be a problem, because the session-data "someBean" has already been
updated and the user is going to send outdated information to the
server.

What are the possible solutions to this issue(s)?

Maybe the RSEF (the rudimental servlet extension framework)
(http://java.sun.com/developer/technicalArticles/Servlets/ServletControl
/) would 
help me with creating multiple sessions for the same users?

And how would someone solve the problem with multiple
browser-windows or -tabs?

TIA,
Daniel





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to