Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

simple question abt session management  RSS feed

 
reehan ishaque
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
i have little confusion abt session management. how can i distinguish between clients using servlet API for session management when there is no user name password facility no the site.
here is the code that we normally write in service method..
HttpSession s = request.getSession(true);
s.putValue("key", "value");
now here i will provide a key to store this particular value. this key is same for all clients as this code is executed each time doGet or doPost method is executed. how will i extract particluar client's info using the key n getValue() method as the key is same for all the clients. please reply me abt it. thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each client will get their own session - thats the whole idea. The servlet engine generates a unique id string that becomes the value of a cookie on the user's browser. It uses that unique id to recover the session.
Bill
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and use s.setAttribute instead of s.putValue
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!