Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why are we not calling main method for servlet and applet  RSS feed

 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I know that to invoke a servlet/applet but why we don't use main method to invoke a servlet/applet (To make a standard for invoking the application). Is it just to differentiate the client/users that they are using standalone program or servlet/applet?
Thanks & Regards,
M.S.Raman
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The signature for main() (an array of Strings as arguments) is ideal for invoking a program from a command line. But it would be lousy for invoking an Applet (how to use main() to tell the applet to initialize, start, stop, or destroy itself?) or especially a servlet (how to pass the request parameters or servlet context to the servlet?)
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also the lifecycle(i.e. instantiation, initialization ..destroy) methods of a Servlet are called by the Servlet container, while the Applet runs inside the clients browser.
Craig
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!