Understanding init, service and ServletConfig
Servlet objects are created in two phases :

There are methods which run before doGet or doPost


init() and init(ServletConfig) and service are part of GenericServlet


service() (overidden from GenericServlet) and doGet ..... are part of HttpServlet


MyServlet will override doGet and doPost .....
Examples :
1) Initparams (Annotation)


2) Using web.xml

Last updated
Was this helpful?