Hi guys.. Well can u tell me that why there is need of
"init()" , i mean why can not we initialize the servlet object
with the help of constructors?
Thank you.
Answer Posted / abhijit mishra
As per Servlet specification, the servlet container is
responsible for creating the servlet and initializing it( or
making it ready for client to request it).
So according to the Client:servlet container contract, the
servlet creation and inialization is done by the container
which will differ for different container provider.
So u can't use constructors to create servlets.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Difference between httpservlet and generic servlets?
Explain their methods? Tell me their parameter names also have you used threads in servlet?
What do you mean by chaining in servlet?
What is the servlet?
What are life cycle methods of a servlet?
When servlet object is created?
What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?
When Servlet is unloaded?
Can we override destroy method in servlet?
What is the major difference between context parameter and context attribute?
What is MIME Type?
What are the phases of servlet life cycle?
Can we fetch the attributes related to a servlet on a different servlet?
Explain the methods of request dispatcher in servlet?
What must be implemented by all servlets?