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's the use of servletcontext?
Why doesn’t a servlet include main()? How does it work?
What is a cookie What is the difference between session and cookie
How to read request headers from servlets?
What is generic servlet class?
How can we upload the file to the server using servlet?
How servlet is created?
What are the phases of the servlet life cycle?
What is servlet container. how it works?
Define the lifecycle for executing a jsp page.
How can you use a servlet to generate a plain text instead of html?
What is servlet? Explain
What is servlet name in web xml?
Describe the phases of servlet lifecycle?
What are the functions of the servlet container?