• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

More than one session for a client

 
riohk kurn
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to have more than one session for each client(using same browser). For example, we have one session to store the items in cart, so this session will be gone after each payment.
Then, client also has another session to keep some personal information, such as, the name of user.
If the answer is not, the usage of invalidate() is not so significant.
 
vasu maj
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is interesting, I think it can be done if it is two different browsers but not within te same browser.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only by using different web-applications. But surely it would be a much better idea to store all shopping cart state in a session-bound Cart object and, after purchase, just remove that one Cart object rather than invalidate the session.
- Peter
 
Rama Raghavan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several objects can be bound to a session.
session.setAttribute("userInfo", userObject)
session.setAttribute("myCart", cartObject)
When the use is done with the purchase, remove cartObject from the session.
I could not see any reason why you need two sessions for storing the kind of information you have stated.
Rama
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic