Different Scopes in Servlet

In servlet, scopes are all about how long your data is available for the user in the web application. Servlet attributes are used for inter-servlet communication, Programmer can set, get and remove attributes in web application. There are four scopes for servlet attributes - page scope, request scope, session scope and application scope. page scope-> Object, request scope -> ServletRequest, HttpSession -> session scope, ServletContext -> application scope represent respectively.

Scopes in Servlet :-

Scope plays an important role in a web application performance. So we must know very well which scope we should use in which scenario.
scopes-in-servlet

 Setting and Getting Attributes from particular scope :-

Scope plays an important role in a web application performance. So we must know very well which scope we should use in which scenario.
setting-getting-attributes-in-scopes