aspose file tools*
The moose likes Servlets and the fly likes not main() in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "not main() in servlet" Watch "not main() in servlet" New topic
Author

not main() in servlet

bakiyalakshmi dhanraj
Greenhorn

Joined: Nov 02, 2007
Posts: 24
Why main() is not written in servlets programs
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

It is all about 'entry points'

When you call a class from the command line, the entry point into your class is the main method.

When you call a Servlet or JSP, the entry point is the service() method, but by default it then calls the doGet or doPost methods for us, so we use these entry points instead.

Applets have a different entry point, they don't have a main() method either.

EJBs are different again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: not main() in servlet