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 |
What is application component provider?
Is core java and j2se same?
What are the advantages of object-relational mapping (orm)?
What is business method?
What is java developer?
Is java part of oracle?
i developed a Stateless Session bean program.And created a client by a common java class as class m {p s v m(String s[]){....}} And i called the bean deployed in weblogic.from cmd prompt And that run. mind it i have to set setenv,seting classpath for that bean jar file before compile and run it. ok when i do a servlet programme deployed in tomcat and call that bean then it give classdefnotfoundException and NoInitialContext like this.So how i sucessfully do this? Ok when i call that bean from java class from the console like i previously told, if i don't set setenv i found the same error on the cmd prompt. pls help to get out of it
How java is used in web applications?
What is initialization parameter?
What is declaration?
Is string a primitive data type in java?
What is difference between javac and java?