This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet instance creation" Watch "Servlet instance creation" New topic
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Servlet instance creation
 
jQuery in Action, 3rd edition