Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query regarding web.xml

 
Div Raj
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 ]
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring 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 ]
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 396
  • 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: 2907
1
Java Spring 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 !
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • 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: 396
  • 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: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Mourouganandame Arunachalam
Ranch Hand
Posts: 396
  • 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: 42967
73
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic