Can we define constructor in Servlet class?
Answer Posted / srikanth b
Yes, we can define constructor in Servlet class.
Constructor may be a Default Constructor or Parameterised
Constructor.
If we didn't write any constructor then the default
constructor will be executed. Because, to read init
parameters of a servlet we need servlet config object in the
life cycle of the servlet. Servlet config object object is
created after the execution of the constructor.
Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What is the purpose of dispatcherservlet properties?
What is the use of httpservletresponsewrapper?
What is a java servlet?
Why is http protocol called as a stateless protocol?
Can servlet have a constructor ?
What do you mean by a filter and how does it work?
What is the workflow of a servlet?
Write all the phases defined in servlet life cycle?
What methods do you use in servlet - applet communication?
When Servlet is unloaded?
Is it possible to have a constructor inside the servlet?
How to get the path of servlet in the server?
How can we refresh automatically when new data has entered the database?
What are important features of Servlet 3?
What is a servlet engine?