aspose file tools
The moose likes JSF and the fly likes more SessionScope beans in the same time. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "more SessionScope beans in the same time." Watch "more SessionScope beans in the same time." New topic

more SessionScope beans in the same time.

massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

Hello everybody, my question is this one.
I have an XHTML page with a session scope managed bean.
I need to open (and let stay open) several pages like this.
Now the problem is that in one hand I need to save some data for the complete session (for this the bean is session scoped), but from the other hand, when I access the page for the second time, the page recall the previous session bean while I would like to create a new one.
in other word I need more than one sessions open in the same time.
do you have any suggestions?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16753

In J(2)EE, the rule is that for each browser, you are allowed one and only one session. When I say "each browser", I mean that if you have IE open and Firefox open and Chrome open, each of those browsers will be working with a distinct and separate session, but that will be 3 sessions, no matter how many browser windows they may open.

JSF doesn't have much support for those of us who keep multiple windows going at the same time. The session bean names are keys into the session object collection and, since there's only one session per client, that means that only one session-scope bean with a given name may exist. I'll also wager that that applies to View Scope, since I think View Scope is just a Session Scope that cleans up after itself.

So about the closest you're going to get is if you make a session-scope object that itself is a collection of objects and make indexed or keyed accesses where each instance of the View (browser window/tab) is assigned its own key or index.

Customer surveys are for companies who didn't pay proper attention to begin with.
massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: more SessionScope beans in the same time.