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
What is session tracking?
What is preinitialization of a servlet?
Explain session tracking and its importance?
What are the life-cycle methods for a servlet?
How would you create deadlock on your servlet?
Differentiate between get and post?
What's the advantages using servlets than using cgi?
why we should override only no-agrs init() method.
How is the get () method different from the post() method?
Is tomcat a servlet container?
What is cgi and what are its drawbacks?
What is the difference between Servlet Request and Servlet Context when calling a Request Dispatcher?
Why the concept of single thread model interface is used?
Can we override servlet service method?
What is the default http method in the servlet?