Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What are the differences between the ServletConfig interface and the ServletContext interface?


The ServletConfig interface is implemented by the servlet container in order to pass configuration information to a servlet. The server passes an object that implements the ServletConfig interface to the servlet's init() method.

A ServletContext defines a set of methods that a servlet uses to communicate with its servlet container.

There is one ServletConfig parameter per servlet.

There is one ServletContext for the entire webapp and all the servlets in a webapp share it.

The param-value pairs for ServletConfig object are specified in the <init-param> within the <servlet> tags in the web.xml file

The param-value pairs for ServletContext object are specified in the <context-param> tags in the web.xml file.
Related Posts Plugin for WordPress, Blogger...
Flag Counter