Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

two pages, single session bean problem

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change the bean's scope to "request"
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic