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 are local interfaces? Describe.
what are getters and setters in Java with examples?
Will the general public have access to the infobus apis?
Is “abc” a primitive value?
Do I have to use jsps with my application?
Why does the tag url-encode javascript and mailto links?
Define aop(assepct oriented programing)?
What is abstract schema?
What does module-relative mean?
Are there books about seam?
Explain about local interfaces.
How a component can be placed on Windows?
Is infobus easy to use?
Are enterprise beans allowed to use thread.sleep()?
If your ui seems to freeze periodically, what might be a likely reason?