ServletConfig vs ServletContext

Sumithra picture Sumithra · Nov 19, 2010 · Viewed 85.5k times · Source

What is the difference between ServletConfig and ServletContext interface?

Answer

lucas1000001 picture lucas1000001 · Nov 19, 2010

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.