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 called servlet mapping?
Can you create a deadlock condition on a servlet?
When should you prefer to use doget() over dopost()?
Where do you define dispatcherservlet?
Can you send an authentication error from a servlet?
What do you mean by a filter and how does it work?
Which exception is thrown if the servlet is not initialized properly?
Which application server is best for java?
Why servlet is mostly used?
Define context initialization parameters.
Why do we need a constructor in a servlet if we use the init method?
What is servlet invoker?
What do you mean by default initialization in java servlet?
What is the use of java servlet api?
How to get the path of servlet in the server?