0

When I open two browsers and enter details parallely, the values are getting mixed. The values in one browser are populated in the other browser... We are using JSF framework and the managed beans are in session scope (having them in request scope is not possible in our case)... In a nutshell, the values are shared across the browsers... How to avoid this? Any clue?

aymeric
  • 3,877
  • 2
  • 28
  • 42
Vineet
  • 79
  • 1
  • 6
  • and the managed beans are ...? – Matt Handy Apr 08 '11 at 09:17
  • See [this question](http://stackoverflow.com/questions/5593298/jsf-session-issue-in-different-browser-windows) (a duplicate?) – Matt Handy Apr 08 '11 at 10:33
  • what you mean by two browsers? two windows of the same browser? – bluefoot Apr 08 '11 at 16:36
  • If you mean two tabs/windows of the same browser, then this is correct behavior. A single browser instance means a single session. (unless you open the window in incognito/private browsing mode as that would not refer to the session cookie stored) – Niks Apr 08 '11 at 19:18

2 Answers2

3

If you "open two browsers" means you open two windows of same browser then everything is correct - you can get just one session per browser (for firefox there is plug-in which allow to avoid this limitation).

But if you use really two different browsers than in this case seams you save all data in application scope or you have a problem with you container.

corsair
  • 658
  • 5
  • 14
1

You need to put the bean in request or view scope instead. Storing request/view based data in a session scoped bean is a bad idea, as you've encountered yourself.

I think the view scope would help a lot, given the fact that you mentioned that the request scope is "not possible" (it actually is, it only requires preloading the right data so that JSF can take the right actions accordingly).

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555