Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt of init method

 
Abhay Choubey
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

when a init() method call when client send a request or as apache tomcat server will start.

Thanks in advance
Abhay
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, init method is a call back method of a server. so, you dont have control on it. but in most of the container, you can ask server to start init method by requesting a servlet or at the time of starting a web application using load-on-startup tag .
 
Abhay Choubey
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
calling the init method depends on the server and its configuration. it can be when -
server start or server get the first request. It is right

thanks in advance
Abhay
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
right!
 
Abhay Choubey
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhay Choubey wrote:Thanks a lot

You are welcome
 
Sergey Baranov
Greenhorn
Posts: 18
C++ Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to specification:

Called by the servlet container to indicate to a servlet that the servlet is being placed into service.
The servlet container calls the init method exactly once after instantiating the servlet. The init method must complete successfully before the servlet can receive any requests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic