Can we define constructors in Servlet?
Answer Posted / vivekanand prasad
The init() method creates and loads the servlet.But the servlet instance is first created through the constructor (done by Servlet container). We cannot write constructors of a servlet class with arguments in servlet (It will throw Exception). So, They provided a init() method that accepts an ServletConfig object as an argument.ServletConfig object supplies a servlet with information about its initialization (init) parameters.Servlet class cannot declare a constructor with ServletConfig object as a argument and cannot access ServletConfig object.
Is This Answer Correct ? | 20 Yes | 3 No |
Post New Answer View All Answers
What’s jboss cache in short?
Is it possible to stop the execution of a method before completion in a sessionbean?
What is aop(assepct oriented programing)?
Explain the advantages and disadvantages of detached objects.
Brief description about local interfaces?
Can I have an action without a form?
Where can I find seam examples and documentation?
Why won’t the jvm terminate when I close all the application windows?
How messaging services are done, before release of JMS?
What you mean by COM and DCOM?
Is there a guarantee of uniqueness for entity beans?
Can I run seam outside of jboss as?
Why does the tag url-encode javascript and mailto links?
what are memory considerations of jsp compares to other web components?
What is the difference between static and non-static with examples?