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
Which protocol will be used by browser and servlet to communicate
Why do we have servlet listeners?
Is java servlet still used?
What is the directory structure of a war file?
What is the life-cycle of servlets?
List the Different types of servlet?
How do you invoke a servelt?
Can we get PrintWriter and ServletOutputStream both in a servlet?
Why the container loads server at the application startup and how?
Can we override destroy method in servlet?
How do we share data using 'getservletcontext ()?
What is the process to implement doget and dopost methods?
What do you mean by servlet context?
What is servlet and its types?
What are different Authentication options available in Servlets.