Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can we call destroy() method inside the init() method? What
happens when we do so?

Answer Posted / amitasite

One can call destroy method from init method. One scenario
in which you would like to call is some resource is looked
up once in init() method and cleaned in destroy() method. If
exception is thrown before it finishes as servlet is not
brought in service, container won't call destroy method. so
to keep resource clean you can call destroy() method from init()

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is servlet api used for conneting database?

1217


What are the advantages of Servlet over CGI?

1133


Explain the architechure of a servlet?

1105


What is string tokenizer?

1060


What is servlet name in web xml?

983


Explain web container.

1017


What exception should be thrown when servlet is not properly initialized?

997


What’s the difference between genericservlet and httpservlet?

1086


Explain how to improve Servlet Performance?

1124


What is the use of servlet wrapper classes?

1173


How would you create deadlock on your servlet?

1170


Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?

1085


What do you mean by request dispatcher in servlet?

1100


What is a web container and what is its responsibility?

969


What do you understand by mime type?

979