This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes destroy method of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy method of servlet" Watch "destroy method of servlet" New topic

destroy method of servlet

sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
hi all,

how many ways we can destroy the servlet. In the realtime did we call destroy method explicitly?

thanks in advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41065
You don't ever call the servlet lifecycle methods - constructors, init, destroy- yourself; the servlet container does it for you.
[ May 09, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

In the realtime did we call destroy method explicitly?

The method will be executed like any other normal method if you call the method explicitly, but it will NOT make the servlet instance eligible for garbage collection.

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
I agree. Here's the link:
subject: destroy method of servlet
Similar Threads
Call destroy() inside init()
calling destroy in init method
destroy method
can we call destroy method in servlet service method?
frnds come up with solution