• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet instance creation

 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic