Difference between ServletsContext and ServletConfig
ServletConfig:It defines how a servlet is configured. ServletConfig is implemented by the servlet container to initialize a single servlet using init (). Every servlet has its own ServletConfig object. Most servlet containers provide a way to configure a servlet at run-time and set up its initial parameters.
Example:<servlet>
<servlet-name> abc </servlet-name>
<servlet-class> first </servlet-class>
<init-param>
<param-name> rno </param-name>
<param-value>10</param-value>
</init-param>
</servlet>
ServletContext:ServletContext is implemented by the servlet container for all servlet to communicate with its servlet container. It is applicable only within a single Java Virtual Machine.
The ServletContext object is contained within the ServletConfig object. That is, the ServletContext can be accessed using the ServletConfig object within a servlet. You can specify param-value pairs for ServletContext object in tags in web.xml file. ServletContext is created at the application level and shared by all the Servlet codes.
<context-param>
<param-name> Name </param-name>
<param-value> Ram </param-value>
</context-param>