how a servlet is instantiated, whether the container calls
init() or by calling any other method? please somebody reply..
Answer Posted / nishidh soni
Servlet is initialized by two ways...
1)By initializing the constructor:-but in the initial version of JDK 1.0 constructor can not be initialized for the dynamic page loading so that init() method for the servlet comes into the picture.
2)By invoking the init() method:-This init() method is invoked by the servlet container at it is invoked once per servlet and it uses the ServletConfig as a object for the initialized parameter.and the it is like
init(ServletConfig config)
{
.....
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How servlet is created?
How the typical servlet code look like ?
What are the advantages of cookies?
Difference between GET and POST?
What are the functions of the servlet container?
What is called servlet container?
What is MIME Type?
What is the difference between the http servlet and generic servlet?
What is the capacity the doget can send to the server?
What is a deployment descriptor?
What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?
What is the difference between CGI and Servlet?
How do you invoke a Servlet? What is the difference between doPost method and doGet method?
How to find whether a parameter exists in the request object?
How the servlet is loaded?