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 getters and setters in Java with examples?
What is in-memory replication?
Explain the difference between object state and behavior?
What are the different algorithms used for clustering?
Define the remote object implementation?
To what value is a variable of the string type automatically initialized?
Are there books about seam?
which book is better for jdbc ,servlets and jsp
What are the different class loaders used by jvm?
Why doesn’t the focus feature on the tag work in every circumstance?
hi friends, i have done my BE(CSE)at 2011 then i have joined one company before they asked me 50k so i paid but now they telling no project here so we r going to close like that so now i need any job i have good knowledge in core java and j2ee(jsp,servlet,jdbc) so if u know any job pl help me
What is RMI and what are the services in RMI?
What happens when a thread cannot acquire a lock on an object?
how to use debug in my elipse to solve problems that exist in my project
how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.