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 / archana

When u create a servlet with a constructor it wont be a
complete servlet but will be in a akward state where it
cannot access Servlet Context and Config.It has to go
through the init() method (though we dont know what code is
written there) to be a complete servlet

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the architecture of a servlet package?

732


What is the effective way to make sure all the servlets are accessible only when user has a valid session?

787


How servlets are deployed in java?

725


How will two or three servlets interact or communicate with each other?

1147


What are the steps that are involved in using the httpservlet class?

831


Explain the servlet context.

804


Why is Servlet so popular?

778


Can we use threads in Servlets?

838


What is servlet container?

867


Which httpsession object is used to view and manipulate information about a session?

939


What is setattribute in servlet?

758


How do we translate jsp?

770


What are the two important api's in for servlets?

795


Explain the features are in servlet 3?

799


Which exception is thrown if the servlet is not initialized properly?

772