Can we have a constructor for Servlets ? Who manages the Object Creation in webserver. What are the role and responsibilities of Servlet Containers for Servlet Invocation. Actually i have one servlet class for which i have written my own constructor but i don't know how to handle this explicitly thru my own code rather than being dependant on container. Will anybody pls help me in this?
posted 14 years ago
The Web container invokes the servlet classes' constructors. Therefore you can only have the default constructor without arguments. If you want to know about the responsibilities of the container and the servlet provider, please consult the specification.