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 / manas banerjee

you can use but should not.the original reason for init()
was that ancient version of java could not dynamically
invoke constructors with arguments.so there was no way to
give the constructors a ServletConfig.So u would not have
to access to ServletConfig or ServletContext.

{{in short:init() has access to servletconfig and
servletcontext object constructor would not..

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a deployment descriptor?

692


When jsessionid is created?

676


What do you mean by filter in servlet?

619


How is a servlet implemented in code?

649


Name the packages that work with servlet?

623






Is servlet synchronized?

688


What is a servlet engine?

630


How can we implement a jsp page?

724


What is http servlet?

669


Write a command to get actual path of a servlet to the server?

629


How can you push data from an Applet to a Servlet?

700


What are the advantages of servlets over traditional cgi?

715


What is the use of welcome-file-list?

645


How forward () method is different from send redirect () method?

604


How do I support both get and post from the same servlet?

793