• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can I set multiple attributes to a session object.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Gonzalez.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
u put all the values in Hashtable, put that into session
r u can loop through ur values
 
reply
    Bookmark Topic Watch Topic
  • New Topic