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
What is the disadvantage of cookies?
Why is a constructor needed in a servlet even if we use the init method?
How do you get the ip address of the client in servlet?
What is the functionality of actionservlet and requestprocessor?
What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?
How will you pass values from HTML page to the servlet?
What's the architecture of a servlet package?
What is the use of welcome-file-list?
When servlet object is created?
What is called servlet mapping?
Describe in brief RequestDespatcher?
Write a program to show the functionality of doget and dopost method?
What is the web server used for running the Servlets?
What are the uses of servlet and what is servlet chaining?
Explain request dispatcher and its methods.