Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can I set multiple attributes to a session object.

 
Ramu Rondla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,
I am developing an e-commerce application. I have a question related to sessions.
I am creating a session like this
HttpSession session = request.getSession(true);
and I can set one attribute (session.setAttribute(name, value)).
but how can I set multiple attributes to this session object.
for example, when the session is created it should set the username and password.
Thanks,
Ramu
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but how can I set multiple attributes to this session object.
session.setAttribute(name1, value1)
session.setAttribute(name2, value2)
session.setAttribute(name3, value3)
and so on....
if you want to have a single object that holds multiple variables you can easily store it in the session (array, hashtable, anything that is an object)
 
Ramu Rondla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Gonzalez.
 
P. Udaya Shankar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
u put all the values in Hashtable, put that into session
r u can loop through ur values
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic