Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet LIfeCycle Methods  RSS feed

 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

We know init()=both versions, and service()methods can be overridden..

can we do something for destroy as well, as we do for Midlets.

of course, things like resource cleaning can be done i think...
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello theepan, Yes, you can override the destroy() method. The application with which I am currently working overrides the destory() method in order to flush the output streams, not doing so causes undesirable output during display. I may also add that it is the destroy() method of the JSP which we override and I guess it holds good for servlets as well. chill
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the docs. There is no other better substitute.
destroy() method is not private nor it is a final method.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
overrides the destory() method in order to flush the output streams,


That sounds odd to me since destroy should only be called at the end of the life of a servlet instance by the servlet container.

Flushing and closing response output streams should be done in the doGet or doPost method.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!