Request , Session and Context Part - 2

Session Object vs Context Object :

Session Object :

  1. One per user/machine

  2. Objects available across requests

  3. Perfect for login sessions and shopping carts

  4. Every request object has a reference to the session object.

Session object is null for other user/browser

Context Object :

  1. Across the entire application

  2. Shared across servlets and users

  3. Initialization code / Common bulletin board

  4. Use the Context object

How to create session ?

Output:

Last updated

Was this helpful?