Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?

Answer Posted / n.l.narayana

yes., when ever the servlet is executed .,it requires
configuration.,the configuration should be done in init()
method only.,

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?

758


What is pure servlet?

902


What is the servletconfig object?

738


Write a program to show the functionality of doget and dopost method?

883


Should I override the service() method?

857


What are all the ways for session tracking?

818


What is the use of java servlet api?

778


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()?

837


What is called Session Tracking?

823


When Servlet is unloaded?

834


Why is init() method is used in servlets?

726


Which event is fired at the time of session creation and destroy?

1103


What is the difference between servlet and jsp?

806


How servlet is created?

777


Who is responsible for writing a constructor?

1006