So, lets get started!!!
For the exam, you need to worry about 3 different scopes. They are:
• Session &
The scope would play an important part of any web application.
Let us look at the details of these 3 Scopes.
|Request||Current, included, or forwarded pages||Until the response is returned to the user.|
|Session||All requests from same browser within session timeout||Until session timeout or session ID invalidated (such as user quits browser).|
|Application||All request to same Web application||Life of container or explicitly killed (such as container administration action).|
For ex: if you use the request.setAttribute(), you will be able to access it only until this request is alive. Once the request is complete, you will no longer be able to read the attribute that you just set into the request.
But, if you set an attribute into the session you will be able to read it across multiple requests. Similarly if you use the context, you will be able to read it across multiple sessions.
Request is the least available whereas a session is a bit more available and the context is globally available. But, it is not advisable to put all your stuff into the context. Keep only information that you would need across all the users of the website in the context. Keep information that you would need as long as a user is browsing (say his login info) in the session and page specific information in the request.
Dont worry if we did not cover the details of the request, scope or the context because, that is exactly what the subsequent chapters are going to do!!!
Previous Chapter: Chapter 12 - Retrieving HTTP Request Header Information
Next Chapter: Chapter 14 - The Request Object