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 the design considerations while making a choice between using interface and abstract class?
we use MainFrame and using os390 for operating system with DB2 data base in IRAN and interest programing with java and use webspere for world wide,please help me where i should start?
Is a class a subclass of itself?
What is the relationship between local interfaces and container-managed relationships?
Which textcomponent method is used to set a textcomponent to the read-only state?
How to implement RMI in Java?
If I wanted to use a solarisui for just a jtabbedpane, and the metal ui for everything else, how would I do that?
What is RMI and what are the services in RMI?
What are the different class loaders used by jvm?
What is the RMI and Socket?
whats is statement and procedure
Which containers use a border layout as their default layout?
What is the purpose of the notifyall() method?
What is ripple effect?
Where we can write Rmi registry in the code, without having to write it at the command prompt?