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
Explain url encoding?
How do we share data using 'getservletcontext ()?
What are the supporting protocol by HttpServlet ?
What is the advantage of Servlets when compared with other server side technologies?
What is the difference between CGI and Servlet?
What is servlet api used for conneting database?
How do I use cookies to store session state on the client?
Difference between forward() method and sendredirect() method ?
What is meant by cookies?
List out difference between a JavaBean from a Servlet?
What are different Authentication options available in Servlets.
What are the servlet events?
Explain the features are in servlet 3?
How to get the actual path of servlet in server?
What's the servlet interface?