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
How are commas used in the intialization and iteration parts of a for statement?
Define the remote object implementation?
For which statements does it make sense to use a label?
Explain about local interfaces.
Which component handles cluster communication in jboss?
How task's priority is used in scheduling?
how to use debug in my elipse to solve problems that exist in my project
What method is invoked to cause an object to begin executing as a separate thread?
What is the relation between the infobus and rmi?
Name the eight primitive java types.
Why does the tag url-encode javascript and mailto links?
hi friends, i have done my BE(CSE)at 2011 then i have joined one company before they asked me 50k so i paid but now they telling no project here so we r going to close like that so now i need any job i have good knowledge in core java and j2ee(jsp,servlet,jdbc) so if u know any job pl help me
Why use a datasource when you can directly specify a connection details?
Difference between swing and awt?
what is a non-repeatable read?