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?
How many servlet objects are created?
What is cgi?
What is war file?
Can we fetch the attributes related to a servlet on a different servlet?
What is servlet in simple terms?
How do I use cookies to store session state on the client?
What are the types of protocols supported by httpservlet ?
What are the phases of the servlet life cycle?
Explain the differences between jsp and servlet.
What is servlet and its life cycle?
How can the session in servlet be destroyed?
What is the use of attribute in servlets?
What is the difference between jsp and servlet life cycle?
How to read request headers from servlets?