This is addressed to people who have written real, non-trivial applications
using sessions: how have you handled users who open multiple windows
(instances of the browser)?

There are two ways the session mechanism handles multiple, and different
browsers cause them to happen under different circumstances:

1. Each window is a separate session
2. Both windows share a session


#1 can be bad sometimes. For example, a Netscape for Windows user gets a
list of widgets from my (hypothetical) widget store, eWidgets.com. She is
interested in UltraWidget, so she clicks on the "purchase" link. UltraWidget
is then added to her shopping cart. The shopping cart info is stored in a
session.

She sees an ad on the page for "UltraWidget Extended Warranty" which she is
interested in. She right-clicks on the link and chooses "Open link in new
window" so she can read about it in a new window. Because of the way
Netscape works, the new browser window means a new session. She wants to buy
the extended warranty so she clicks the "Add to shopping cart" link and it
is added to her shopping cart.

But because she has two sessions going on, only the extended warranty is in
her shopping cart. She gets confused and starts swearing and turns her
computer off, cheating me out of a $45,000 widget sale.

Had she been using Internet Explorer for Windows, both windows would have
shared a session and she wouldn't have gotten confused.


#2 can be bad sometimes too. For example, an Internet Explorer for Windows
user wants to find all blue widgets and all green widgets, so he goes to the
search page of eWidgets.com and types in "blue" and hits "search".

When his results come back, he remembers that he also wants green widgets,
so he chooses "New Window" from the "File" menu which gives him a duplicate
window (and which shares the same session). He types "green" and hits
"search" and gets back a list of results.

He then goes back to the first window (the one with the blue widgets) and
clicks the "next page" link, which shows him the next page of *green*
widgets, because the search results were stored in the session and the green
results overwrote the blue results. He gets annoyed and starts playing
Quake, cheating me out of some widget sales.

Had he been using Netscape for Windows, each window would have had its own
session and the search results wouldn't have gotten mixed up.


So what do *you* do about sessions an multiple windows? Just hope that users
don't open multiple windows? So far, I've been ignoring sessions and passing
parameters around, but I'm writing a complex application and the parameter
passing is getting out of hand.


Thanks in advance,
Erik

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to