wood burning stoves 2.0*
The moose likes JSF and the fly likes two pages, single session bean problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "two pages, single session bean problem" Watch "two pages, single session bean problem" New topic
Author

two pages, single session bean problem

Gytis Jakutonis
Ranch Hand

Joined: Feb 02, 2004
Posts: 76
Hello,

I'm using managed bean from session scope to handle page data and actions. It is not clear how to handle situation, then the same client (single session) opens the same page in two browser windows with different data selected. Obviously session bean stores data for the last request only. So that happens on the first page submit (some action activated) - the only one session bean gets activated to handle the action. Action was activated from the first page, so user expects to get first page data submited. But session bean already contains data for second page, and submited action performs activities on that data. Is it possible to prevent such situation in JSF? Any ideas?
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
Originally posted by Gytis Jakutonis:
Hello,

I'm using managed bean from session scope to handle page data and actions. It is not clear how to handle situation, then the same client (single session) opens the same page in two browser windows with different data selected. Obviously session bean stores data for the last request only. So that happens on the first page submit (some action activated) - the only one session bean gets activated to handle the action. Action was activated from the first page, so user expects to get first page data submited. But session bean already contains data for second page, and submited action performs activities on that data. Is it possible to prevent such situation in JSF? Any ideas?


I don�t know if I understand your problem, the only thing is that the session bean is the same for both browser windows beacause for you browser there is only one Session Instance. So if you modify data in the first window th second window shoul see that information. The way to prevent this I think is to change your bean to request scope, so every window can hava a different instance of that bean. I hope this will help.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
change the bean's scope to "request"


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: two pages, single session bean problem
 
Similar Threads
File upload
Reusability of the form
Lifecycle of a SFSB with respect to activation
mock questions
How can i redirect from jsf action to my own servlet ?