servlet context definition

  • ServletContext is a configuration Object which is created when web application is started.

  • It contains different initialization parameter that can be configured in web.xml.

  • Difference from ServletConfig

    • ServletConfig is one per servlet while ServletContext is one per web application.

    • ServletContext is available to all servlet & jsp in web application

      while ServletConfig will be available only specific servlet.

    • Difference in the syntax for servletcontext and servletconfig.

quoted from