Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Session Attribute

 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello
In my application I set username as a session attribute - 'username'
But when I run the application in two different browser windows,
both windows show same values for the 'username' attribute
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Report post to moderator
That's true, because it's the same session

Regards,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Depending upon which browser you are using and how the browser instances are created, the browser instances may share cookies. Since sessions are maintained by an id value stored as a cookie, this means that any instances that share cokkies will share the session.
[ November 04, 2007: Message edited by: Bear Bibeault ]
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Vassili Vladimir:
That's true, because it's the same session

Regards,


Thank you, Vassili
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Bear Bibeault:
Depending upon which browser you are using and how the browser instances are created, the browser instances may share cookies. Since sessions are maintained by an id value stored as a cookie, this means that any instances that share cokkies will share the session.

[ November 04, 2007: Message edited by: Bear Bibeault ]


Thank you, Bear
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Pranav Pal:


Thank you, Bear


How do I assure that browser instances do not share cookies?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
I believe that this primarily a problem with IE. If I recall, when you create a new instance from an existing window (as iwth ctrl-N), the instances will share cookies. If you create a new instance from the Start Menu, no sharing.

Check this before assuming that I'm remembering correctly.
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Bear Bibeault:
I believe that this primarily a problem with IE. If I recall, when you create a new instance from an existing window (as iwth ctrl-N), the instances will share cookies. If you create a new instance from the Start Menu, no sharing.

Check this before assuming that I'm remembering correctly.


Thanks..
If I open a new tab in existing window then only they are sharing cookies..
If I open two different windows then they do not share cookies..

I have another problem..
In a servlet I insert a row in the database
Then I dispatch the request to a jsp
If I refresh the jsp page in browser then the row is again unnecessarily inserted in the databse
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Pranav Pal:
I have another problem..

Please open a new topic for new questions.
 
    Bookmark Topic Watch Topic
  • New Topic