• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

more SessionScope beans in the same time.

 
massimo tarantelli
Ranch Hand
Posts: 35
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18153
52
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
massimo tarantelli
Ranch Hand
Posts: 35
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic