File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Lazy initialization of the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Lazy initialization of the servlet" Watch "Lazy initialization of the servlet" New topic

Lazy initialization of the servlet

Aaron Raja
Ranch Hand

Joined: Jun 07, 2007
Posts: 206
Per my understanding when Servlet Container calls the init method on a servlet instance ...

"The servlet container calls init(ServletConfig) method at most once on a Servlet instance. It is guaranteed to be called before the container delegates a request to the servlet instance. "

In lazy initialization: It is possible that the container may never call the init method. This happens usually when the containers do lazy initialization of the servlet. i.e. they call the init method only upon first request to the servlet.

When lazy initialization of the servlet come to play role? what senerio and how it is done( DD or on code)? Is it covered for Test?

Thanks, AR
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

All servlets are lazy loaded, unless the <load-on-startup> tag is specified in the deployment descriptor. In any case, the servlet life cycle is the same, which means that the init method will be invoked by the container.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Lazy initialization of the servlet
It's not a secret anymore!