67 How servlet program is execute without main method | Adv Java Servlet Programming Tutorial

Veröffentlicht am: 27 Februar 2018
auf dem Kanal: tech fort
864
36

#Advance #Java #Servlet #Programming #Tutorial | #adv java | #Que. #How #servlet #program is #executing #without #main(-) method? #Servlet #interview #question
Ans : 1) We give standalone application class directly to JVM for execution,
so main(-) method is required in that class to begin execution.

Servlet program is not a standalone application to execute from command prompt so main(-) is not required in servlet program.

2) Servlet container executes our servlet program through life-cycle methods, since main(-) method is not a life cycle method, so main(-) method is not required in servlet program.

3) If running java application/container wants to create object of certain java class and wants to call methods on that object then there is no need of main(-) method in that class.

Servlet container is contineously running application in server, which executes our servlet program by creating object of our class & by calling life-cycle methods on that object, so there is no need of main(-) in servlet class.

Practical Proof:
----------------
Step 1) Open bootstrap.jar file

Step 2) Go to org.apache.catelina.startup.Bootstrap class

Step 3) Search for main() method.

This Bootstrap.class file contains the logic in main(-) method to start the server & to activate servlet-container, jsp-container.

Note : When life-cycle event is rised, servlet-container calls the life-cycle methods automatically but life-cycle event will not be raised by container when programmer calls life cycle methods manually.


Auf dieser Seite können Sie das Online-Video 67 How servlet program is execute without main method | Adv Java Servlet Programming Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer tech fort 27 Februar 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 864 Mal angesehen und es wurde von 36 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!