Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unique session for every tabs of browser window

 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a application that have a functionality to login and insert some data. i am using session but if user copy and paste the url in other tab than i want to redirect user to login page. can you advice me to what to do for it. only flow will also work it for me.

thanks

prashant
 
German Gonzalez-Morris
Ranch Hand
Posts: 263
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would be a browser feature. The servlet doesn't handle that.

Depending on the browser you are using, it can be configured or in some cases to download a plug-in to achieve that behavior.
(I meant for IE, FF, Chrome)
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it does not depend on browser after this post i have tried and i have achieved that...
by the way thanks for your reply..

regs

Prashant
 
German Gonzalez-Morris
Ranch Hand
Posts: 263
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so how did you achieve it ?

for instance, for FF each new tab stays in the same session, we can do a simple test case to replicate that.
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have achieved it by the way of cookies
first store cookies values like name and session id as null when application first starts ...

than create and save value to that cookies when use logged in

than on login page write some code for authentication that if same session id from cookie than redirect to login page. the session.getSession(true); will get new session

and i am using servlet so if i copy and paste it on other tab than the parameters from login jsp will be null so it will redirected to login page....thats how..i have done it


regs

Prashant
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if cookies are disabled and what if each tab, uses a different sessionid (not sure, if any browser does that, but what if). I still think and read some where that it is a browser dependent.
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its not browser dependent man you go to any banking web site and login than copy url and paste it ...you will got error. it is possible in every browser .....

and if cookies are disabled than it should be enabled by our application....
regs
Prashant Chindhade
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your application cannot enable cookies if they are disabled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic