I studied in Java, that each Java file should have a Main method. And the name of that class in which the main is written should be the file name. But in the development of a web application, it is not followed. Here everything is a file named web.xml Why is it so? Then how the files are executing?
Could anyone help me? [ November 17, 2008: Message edited by: Bear Bibeault ]
As Sagar pointed out, this is not correct. Very few Java classes have a main method. Only the main class of Java desktop applications have it in order to start them.
Other possibilities are applets (which are controlled by the browser through the java.applet.Applet interface) and servlets, which are controlled by the servlet container through the javax.servlet.Servlet interface.
With servlets, the web.xml file contains the name of the class implementing the Servlet interface. This class is then instantiated by the servlet container, and its lifecycle managed through the methods of the Servlet interface.