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


Please Help Members By Posting Answers For Below Questions

Why are servlets used?

733


How is the get () method different from the post() method?

723


What is the process for chaining servlet?

786


Which event is fired at the time of session creation and destroy?

1098


What's the use of servletcontext?

873


What are the key methods that are involved in processing of http servlets?

854


What are different methods of session management in servlets?

995


Difference between doget and dopost?

900


Explain web application directory arrangement?

781


What is meant by a web application

739


What do you mean by interservlet communication?

774


What is the difference between the http servlet and generic servlet?

860


What is a servlet context?

810


Explain the features are in servlet 3?

796


What are different ways for authentication of servlet?

722