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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "more SessionScope beans in the same time." Watch "more SessionScope beans in the same time." New topic
Author

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?
thanks
Massimo


IDE: NetBeans 7.1 - Java:1.7.0_2 - JSF 2.0/2.1 - Mojarra 2.1.3 - Primefaces 3.2 - GlassFish 3.1.2
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

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

thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: more SessionScope beans in the same time.
 
Similar Threads
passing parameters in jsp
beans
Is there a "page load" type of event?
One Session Bean is enough for whole application
setProperty and thread safety