Hi Arun,
They return ServletContext and servletConfig objects respectively.
ServletConfig: This is used by the container to pass information to the servlet while initializing. Information like init parameters and their values are available in this object. Info like
JDBC driver name, path to database and stuffs like this can be obtained from servlet config.
In short, this gives information for a given single servlet
ServletContext: This represent the compete web application within a JVM. Typical web app containing servlets, JSPs, beans etc., run inside a single context called servlet context - a virtual wrapper. All application components can get their initialisation parameters, application attributes etc., from this object.
I short this allows application components to interact with each other and fetch application wide info from the container.
So,we can say that servletconfig is verymuch related to servlets and servletcontext is related to the container.
If anybody discovers that any of my statement/s to be incorrect, please do correct me.
Thanks everybody!
Regards,
Sriram