• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Whose object call init() and service.

 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
init() metghod is called by the framework.But which class' object call init() method.Our servlet class or any other class' object.Similarly for service().
Bye.
Viki.
SCJP2.
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Viki,
The servletengine alias webcontainer calls these methods. Servlets are not standalone.
init is called when the server starts.
service is is called when a new browser-request is send to the servletengine. The service method runs automatically in a new Thread.
This is a little simplified.
Axel
Axel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic