• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

query regarding web.xml

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 !
 
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sagar Rohankar:


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




Oops.... I overlooked... Sorry
 
Div Raj
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 398
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Message for you sir! I think it is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic