aspose file tools*
The moose likes Beginning Java and the fly likes query regarding web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "query regarding web.xml" Watch "query regarding web.xml" New topic
Author

query regarding web.xml

Div Raj
Greenhorn

Joined: Nov 04, 2008
Posts: 22
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 ]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by Div Raj:
I studied in Java, that each Java file should have a Main method.

Nope , not necessarily,
Originally posted by Div Raj:

And the name of that class in which the main is written should be the file name.


No. The file name of any Java code is not necessarily be same as that of class name, but it must be same as the name of public class of that file ..

ie, If your java file contain no public class , you can save that file by any name.. but not true if you do vice versa !
[ November 13, 2008: Message edited by: Sagar Rohankar ]

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Hi Divya,

As stated by "Bear" in the other thread, you need to adjust your display name as per Javaranch basic rules. If you don't know how to change, please ask.... :-)

Thanks for your understanding.

Mourougan


Mourougan
Open Source leads to Open Mind
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by Mourouganandame Arunachalam:
Hi Divya,

As stated by "Bear" in the other thread, you need to adjust your display name as per Javaranch basic rules. If you don't know how to change, please ask.... :-)

Thanks for your understanding.

Mourougan


I think, the display name is "Div Raj" , is fine !
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
each Java file should have a Main method

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.


Ping & DNS - updated with new look and Ping home screen widget
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Originally posted by Sagar Rohankar:


I think, the display name is "Div Raj" , is fine !



Oops.... I overlooked... Sorry
Div Raj
Greenhorn

Joined: Nov 04, 2008
Posts: 22
Thank you

But could you please tell me what is Java Desktop application?
Is it that the core Java programs which we will run in command prompt?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
Yes.
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Yes, you can develop two types of applications in java. Desktop based standalone applications and Web based applications.

I think, this is not the right forum for this question.

Mourougan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
you can develop two types of applications in java. Desktop based standalone applications and Web based applications.

There are any number of ways in which Java classes might be used by applications. Desktop apps and web apps are just two possibilities; applets and EJBs are further examples.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query regarding web.xml
 
Similar Threads
Class and Java file
Empty java file
Mojo encountered an error while executing:
main in multiple classes
Web.XMl in JSP