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
Is servlet thread safe?
how many jsp scripting elements are there and what are those?
What is Client-Server Computing?
What do you mean by the servlet chaining?
Explain the difference between servletconfig and servletcontext in servlet?
What’s the difference between genericservlet and httpservlet?
Define the lifecycle for executing a jsp page.
Can we refresh servlet in client and server side automatically?
What is the use of java servlet api?
What exactly are the functions of servlet?
Tell the new features added in servletrequest interface i.e. Servlet 2.4
Differentiate between the get and post method
What are the life-cycle methods for a servlet?
What are the types of servlet?
What is pure servlet?