Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?
Answer Posted / tharun raj
yes, we can provide a constructor in servlet calss..
Webcontainer uses the similar code shown below for creating
servlet object for our servlet class
Class c=Class.forName("OurServlet");
Object o=c.newInstance();
this newInstance() method uses zero argument constructor
while creating object..
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
Who is responsible to create the object of servlet?
How is an application exception handling is done using a servlet?
How can the referrer and the target urls be used in servlet?
What's the difference between servlets and applets?
Explain the difference between servlet and cgi?
What is the advantage of Servlets when compared with other server side technologies?
What are the features added in Servlet 2.5?
What are the difference between session and cookies in servlet? Explain
Explain the role of dispatcherservlet and contextloaderlistener.
Tell us something about servletcontext interface.
Write a command to get actual path of a servlet to the server?
What do you mean by cgi?
What is cgi?
What are life cycle methods of a servlet?
Is servlet a framework?