• 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 session works?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anybody tell me how session works
what is the use of session id.
please help me
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Sessions are much like a Map that the container stores on a client by client basis in another Map. To identify which session belongs to which client the container generates a unique id, (I don't know the method that the container uses to generate the id) which it uses as a key to the Map it keeps internally of all the sessions. The id is passed to an from the client either in a cookie or as part of the request in a parameter.

When the Servlet or Jsp code requires a session attribute it gets the appropriate session object from the container (note this is already done for you in JSP's) which in turn goes to its map and uses the jsessionid cookie value (or request paramter value) as the key to get the appropriate session, which it then passes back.

The Session itself is mainly used to store attribues for a client, ie all the goods in their shopping cart, etc.

I should add that this is vastly simplified for the sake of a simple explanation.

HTH Mat
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic