Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?
Answer Posted / chandra
constructor required, but it should be public no-argument
constructor. even though if you are not write that
constructor java compiler will create that construtctor by
default. for that your servlet class should be public other
wise you will get RuntimeWxception saying RequestedResource
is not available like that.
Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
Is it possible to have a constructor inside the servlet?
How printwriter is different from servletoutputstream?
What do you mean by deployment descriptor?
List some life cycle methods of a servlet.
Which method is called when reference variable is passed in system.net?
What are advantages of servlets over cgi?
What is meant by cookies?
How do you load an image in a Servlet?
Explain the difference between servlet and cgi?
What is the structure of the http response
Tell us something about servletconfig interface.
Explain the difference between generic servlet and http servlet?
What is the use of send redirect () method?
What is called servlet container?
What are the difference between session and cookies in servlet? Explain