When the project is deployed, the web container creates a ServletContext object. The web.xml file can be used to retrieve configuration information using this object. Each web application has just one ServletContext object. It is preferable to provide information from the web if it is shared throughout numerous servlets.\
The ServletConfig parameters are unique to one servlet and are not shared by other servlets. It is employed for the purpose of initialization. Outside of any specific servlet, the ServletContext parameters are set for an entire application and are available to all servlets within that application.
The getServletConfig() method of the Servlet exposes a ServletConfig object for each Servlet. A ServletConfig object has methods for retrieving initial parameters for a specific Servlet, as well as the getServletContext() function for obtaining the proper ServletContext instance.
ServletContext has a "application" scope, and its setAttribute("name", object) and getAttribute("name", object) methods can be used to communicate information across servlets inside the same application ("name").
The web container creates a ServletContext object for each Web application. The ServletContext object is used to retrieve configuration information from the Deployment Descriptor(web. xml), which is available to any servlet or JSP in the web app.
Share With Friend
Have a friend to whom you would want to share this course?
Download LearnVern App
Download the app
Learn anywhere on the go
Get regular updates about your enrolled or new courses
Share content with your friends
Evaluate your progress through practice tests
No internet connection needed
Enroll for the webinar and join at the time of the webinar from anywhere
Enjoying this course!
All the Courses on Learnvern are Free! So Register/Sign in to
have Access all the Courses and Videos.