The web app developer should not provide any constructor for a servlet. It's for the servlet container to construct servlets using the no-argument constructor. Anything the app developer needs to do for servlet initialization should go into one of the "init" methods. Also see http://faq.javaranch.com/java/ServletsFaq#lifecycle for further information.
As i saw in cavaj decompiler default servlet constructer has been created .... and i also in Head first Servlet that after loading the servlet class it runs servlet constructer provided by the compiler ... tell me how exactly container executes servlet class files in detail are please provide me a link to go through
Joined: Mar 22, 2005
Yes, the compiler will insert a no-argument constructor if the developer didn't add any constructor. (A constructor is needed to, well, construct objects.) But that's standard Java behavior, not specific to servlets. The developer still shouldn't use any constructor in a servlet.
You'll find lengthy explanations on the servlet lifecycle by googling for "servlet lifecycle". It shouldn't be necessary to provide a link for that - you can find those yourself easily.
Joined: Apr 06, 2009
ya Ok but i had one doubt is it the container after loading the servlet class create object of my servlet class and call init service destroy method.....?