Answer Posted / chandra kunchala
yes ofcourse we should.
it is mandatory for servlet.
for servlets we required publc no argument constructor. if v
don't having that one, our servlet should not work, even
though if you are not crating the public no-argument
constructor, the java compiler will take the responsibility
to create public no- argument constructor.. mean while your
servlet should be public otherwise you will get
RuntimeException.
we can create costructor for sevelet but it should b no-
argument constructor. and u r servlet should be public.
and one more thing this constructor in not in the place of
init() method..
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is the difference between servlet and jsp?
What is the difference between a generic servlet and http servlet?
What is the workflow of a servlet?
What are the phases of a servlet life cycle?
What mechanisms are used by a Servlet Container to maintain session information?
What is a java servlet?
What are the functions of an intercepting filter?
Is servlet thread safe?
What is difference between the HTTP Servlet and Generic Servlet? Explain about their methods and parameters?
How can we implement a jsp page?
When a servlet accepts a call from a client, it receives two objects. What are they?
What are the functions of Servlet container?
What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method?
Whether thread can be used in servlets?
What is the difference between using getSession(true) and getSession(false) methods?