Search code examples
servletsservletconfig

ServletConfig vs ServletContext


What is the difference between ServletConfig and ServletContext interface?


Solution

  • The ServletConfig parameters are specified for a particular servlet and are unknown to other servlets. It is used for intializing purposes.

    The ServletContext parameters are specified for an entire application outside of any particular servlet and are available to all the servlets within that application. It is application scoped and thus globally accessible across the pages.