servlet has not any main method in it how does it work by
JVM?
Answers were Sorted based on User's Feedback
Answer / srinivasa kumar meda
The life cycle of a servlet is controlled by the container
in which the servlet has been deployed. When a request is
mapped to a servlet, the container performs the following steps.
If an instance of the servlet does not exist, the Web container
1. Loads the servlet class.
2. Creates an instance of the servlet class.
3. Initializes the servlet instance by calling the
init method.
Invokes the service method, passing a request and response
object.
Is This Answer Correct ? | 24 Yes | 1 No |
Answer / ananth
Servlets has init() method to load the initial steps for
loading servlet instance in the server class path at the
first time of the servlet engine has starts.
Is This Answer Correct ? | 17 Yes | 1 No |
Answer / suresh
plese put the correct answers dont say rong number peoples was visiting ths site dont say stupid answers
Is This Answer Correct ? | 14 Yes | 7 No |
Answer / nishita
The request mapping is done in web.xml which maps URL to
the Servlet which should handle the request. When the user
hits the URL on the browser, the request is redirected to
Webserver from the code. The Web container decides which
Servlet to call based on the mapping in Web.xml. This
servlet (if it was not loaded at server startup) will first
get loaded then, it gets instantiated and then its init()
method is called. This is called only once. The
initialization happens here. After that the servlet is
ready for service, service() method is called. The service
() method can be called any number of times. Hence, without
a main method the servlet is called.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / sk.bilal ahmed
Servlets has work by init() method to load the initial
steps for loading servlet.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / psreddy
whenever send a request for any resource , First the
webcontainer will recieves the request and after it will
create two objects that objects are request and response
objects then it will match the url pattern in web.xml ,
afer that it creates Servlet Object .
Is This Answer Correct ? | 2 Yes | 1 No |
no man first the constructor will run then the init()
method
which are used to intialization step likee servletconfig
then after service() method for all thread which will
create for the only on instance of servlet
what the mean is it people think that always the instance
of servlet always create when the requst for the particular
servlet but here only the one instance of servlet and the
the service method will excecute for distinct request
ao don't ever think that
note: that the constructor is default constructor you are
no able to call this constructor
so first the constructor will run
this servlet object it just a noraml object
but after the servletcofig it will be the servlet object
so the constructor will run
thanks
amitsing2008@gmail.com
amit09mca(scjp1.5 and many more)
Is This Answer Correct ? | 3 Yes | 5 No |
Since we can create managed bean by two ways as, we can define the bean name in faces-config.xml file so that page can use that OR we can write annotation on bean class so that it is automatically assign to page but I want to know which one is good programming practice ? And also mention disadvantage of other which should not prefer ... Thanking you...
What is attribute what is asant?
What is javaserver pages (jsp)?
What is java awt event?
How will you explain load() and get() methods?
What is a j2ee module?
What is multi tier architecture in j2ee?
What is jetty in java?
Which server is best for java?
What is java developer job description?
Is java is fully object oriented?
What are the components of awt in java?