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 are its drawbacks of cgi?
What is servlet and its types?
Define servlet mapping?
Define context initialization parameters.
What are the disadvantages of storing session state in cookies?
Can you refresh servlet in client and server-side automatically?
Is it good idea to create servlet constructor?
What do you mean by scope object and what are its types?
Why filter is used in servlet?
What is string tokenizer?
Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?
Why the container loads server at the application startup and how?
What is servlet and its use?
What if you need to span your transaction across multiple servlet invocations?
What is session tracking?