my dog learned polymorphism
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 Building Microservices this week in the Design 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: 17046

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.

An IDE is no substitute for an Intelligent Developer.
massimo tarantelli
Ranch Hand

Joined: Jun 19, 2012
Posts: 35

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: more SessionScope beans in the same time.
It's not a secret anymore!