when Servlet Context and Servlet Cofig objects are created

Each Servlet will have it's own ServletConfig
The information in Servlet Context is common to the all component(servlet's)


  • Container will loads the servlet.class file
  • Container will invoke the Default constructor
  • Container invoke init() method

Note:Before invoking the init() method two objects are created


  • ServletContext
  • ServletConfig

If you have any init-param in your web.xml ,then it will create an object holding the references and it will pass reference to the ServletConfig object


If you have something information that will be shared by the whole application,then it will create an object pass the reference to the ServletContext

No comments:

Post a Comment