1

I am creating website using JSF 2.0 where I have all in session bean for some work. All is working perfectly, however problem occur when I open same site in another tab or I right click and say Open in new tab.

Lets say I have list of users and on clicking the user name, I see the details of all that user. Now if I right click and say Open in new tab I see details of User A in Tab A. I do same for User B. I know as my bean is in session bean and I clicked last as User B, if I refresh tab A, I will see data of User B.

I would like to know, how could I start new session when I open the same site in new tab OR I right click and open as Open in new tab?

Note : As per BalusC answer, I should use View Scope, however there would be many changes in my programming. So for this website, I am thinking of using any other alternate way where I can start new session when I open same site in new tab.

If I open same site in another browser, I see new session. Is there any way where I can start new session in same browser?

Community
  • 1
  • 1
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
  • 3
    Your webapp was just badly designed from beginning on. You shouldn't fix it by hacks/workarounds, but by coding it the right way. Bite the bullet and fix your webapp. Remember the lessons learnt for the next webapp project. – BalusC Nov 28 '12 at 12:55
  • @BalusC : Sure, from next project, I will take care of the beans. Can you suggest me what scope to use for [this question](http://stackoverflow.com/questions/13604314/what-should-i-keep-in-what-scope) – Fahim Parkar Nov 28 '12 at 13:13

1 Answers1

2

It's better to use the view scope anyway. Creating a session per tab is rather hard and error prone, plus you'll instantly lose the real session.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140