This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Methods of creating Servlet instance? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Methods of creating Servlet instance?" Watch "Methods of creating Servlet instance?" New topic

Methods of creating Servlet instance?

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi guys,
In how many ways one can create instance of Servlets?.
For e.g.
One method is to create instance in init() method, so when ever the server loads, a servlet instance will create.
I think there must be more methods.May be there is a method which creates instances when ever 1st request is made by client.

Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
You don't create a servlet instance. The server creates the servlet instance. The init method does not create your servlet instance -- instead it is called after it is created.
The instance is created by the framework in one of two ways, either on web container startup (as indicated by the "load-on-startup" tag) or upon first invocation by a client.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: Methods of creating Servlet instance?
jQuery in Action, 3rd edition