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
What is servlet name in web xml?
What are the life-cycle methods for a servlet?
What is the purpose of requestdispatcher interface?
What’s the difference between sendredirect and forward methods
What is servlet and its advantages?
What is the purpose of dispatcherservlet properties?
Is that servlet is pure java object or not?
What do you mean by session tracking and also explain its techniques?
What are the difference between RMI and Servlets?
Why don't we write a constructor in a servlet?
What is meant by session? Tell me something about httpsession class?
What are different Authentication options available in Servlets.
What is the use of attribute in servlets?
What is http servlet in java?
What is called Session Tracking?