• There are 3 scopes available in Servlet.
o Request scope
o Session scope
o Context or Application scope
• You can store and manipulate data with the above-scoped objects as attributes with the following methods:
o Void setAttribute(String, Objetc)
o Void removeAttribute(String)
o Object getAttribute(String)
o Enumeration getAttributeNames()
• When the data is stored in the HttpServletRequest object, the scope will be request scope.
• The data from the request scope can be accessed by that single user in that request only before sending the request to the client.
• When the data is stored in the HttpSession object, the scope will be session scope.
• The data from session scope can be accessed by a single user across multiple requests (within the same session).
• When the data is stored in the servletContext object, the scope will be context scope.
• The data from the context or application scope can be accessed by multiple users across multiple requests.