Answer Posted / surajkumar.java
1. The servlet is controlled by the container in which the
servlet has been deployed. When a request is made to a
servlet, its mapping is searched in web.xml. If mapping
found then the web container loads the servlet class and
creates an instance of it and initializes (e.g servlet
context parameters, database connections objects etc) the
servlet instance by calling the init method.
2. Then invokes the service method, passing a request and
response object. The service provided by a servlet is
implemented in the service method of a GenericServlet and
the doMethod methods (where Method can take the value like
Get, Delete, Options, Post, Put, Trace) of an
HttpServlet. Basically a service method extract information
from the request, access external resources, and then
populate the response based on that information.
3. The container calls destroy method to remove servlet
instance. We also do some specialized handling like closing
a connection, freeing the memory used by local variables etc
by explicitly defining the destroy method inside a servlet
class.
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What are the pros and cons of detached objects?
What is permgen or permanent generation?
Why does the option tag render selected=selected instead of just selected?
What is the difference between java class and bean?
What are the difference between RMI and CORBA?
Can I use javascript to submit a form?
What is meant by method chaining?
What are the benefits of detached objects?
difference between ejb,struts,hibernate,spring and jsp
Why doesn’t the focus feature on the tag work in every circumstance?
What is ioc concept?
What is the purpose of the notifyall() method?
What is mdb and what is the special feature of that?
AS a developer will u create a data source in connection pool? If so how will u do that, how to access the object from connection pool using IRAD tool?
Explain ioc concept?