jackrobert
jackrobert

Reputation: 131

Single user for whole application?

In my application, JSF2.0, richfaces 3.3.3 and Tomcat.
I need, to prevent user multiple tabs in same browser.
Means, If the user login into the application, after that copying the url and paste into the other tab..that time i need to logout that user..

Help me... Thanks inadvance.

Upvotes: 0

Views: 62

Answers (1)

BalusC
BalusC

Reputation: 1109292

You can and should not. You can not, because it can never be achieved reliably. JavaScript can do a lot, but you're still dependent on whether the enduser has it enabled and or the browser can successfully fire a (XML)HTTP request before the unload event, which is really a race condition. You should not, because it would completely destroy the user experience and only result in "wtf?" experiences.

You need to fix the real underlying problem for which you thought that this would be the right solution. This smells too much like session scope abuse. In that case, take your time to go through How to choose the right bean scope? You seem to really need the view scope instead.

Upvotes: 1

Related Questions