• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Life  RSS feed

 
Jerret Halter
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading some notes on a servlet's life and my understanding is that the Container will instantiation the servlet and then call the init() method which then makes it a true Servlet, the container will then call the destroyed() method when needed. If the init() and destroyed() method is called only once in a servlet's life does this mean that when a servlet is destroyed that it will never be instantiated again until the web application is redeployed?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The init() and the destroy() method are called only once for *each instance* of a servlet. So if the servlet is destroyed by the container, and later on a user tries to access that servlet, then a *new instance* of the servlet will be created and init() method will be invoked on that *instance*.
 
Jerret Halter
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks 4 the help
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!