wood burning stoves
The moose likes Servlets and the fly likes Servlet instance creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet instance creation" Watch "Servlet instance creation" New topic

Servlet instance creation

Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 423
Hi, How Servlet container will create Servlet instance..I read the following ways in the net but not sure which one is right

1. Container use any Reflection API.
2. Container calls class.forName(classname).newInstance()
3. Container calls init() method

OCPJP 6.0-81% | Preparing for OCWCD
http://www.certpal.com/blogs/cert-articles | http://sites.google.com/site/mostlyjava/scwcd |
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

The container can create an instance any way that it wants to -- the Specification doesn't mandate any particular way.

After the servlet instance is created, its init() life-cycle method will be called regardless of how the container has chosen to perform the instantiation. This is not a means by which instantiation happens, but something that occurs after instantiation.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Servlet instance creation
It's not a secret anymore!