tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duan, Nick" <>
Subject RE: Multiple Sessions per user
Date Thu, 16 Feb 2006 19:12:35 GMT
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.


-----Original Message-----
From: Daniel Guggi [] 
Sent: Thursday, February 16, 2006 8:22 AM
Subject: Multiple Sessions per user


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.

The user is logged and requests a jsp page that has the following
<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
the data in db. As a result the session-variable "someBean" gets

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

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

Maybe the RSEF (the rudimental servlet extension framework)
/) would 
help me with creating multiple sessions for the same users?

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


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message