• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet

 
Prashant Kirtiwar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we invoke destroy method of a servlet in it's service method?
if yes,what would be the effect and if no why?
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we invoke destroy method of a servlet in it's service method?

Yes. It is like any other method. So, you can call it from the service method.

if yes,what would be the effect?

Nothing special. The statements in the destroy method gets executed, as it would happen in any other method.

The only thing special with the destroy method is that, this method is called by the Servlet Container when the servlet is unloaded.
[ July 08, 2005: Message edited by: Mani Ram ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mani Ram:
[qb]can we invoke destroy method of a servlet in it's service method?

Yes. It is like any other method. So, you can call it from the service method.

if yes,what would be the effect?

Nothing special. The statements in the destroy method gets executed, as it would happen in any other method.

The only thing special with the destroy method is that, this method is called by the Servlet Container when the servlet is unloaded.

[ July 08, 2005: Message edited by: Mani Ram ][/QB]



Further, there is no reason to ever call the destroy method yourself.
 
Sharad Agarwal
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prashant Kirtiwar:
can we invoke destroy method of a servlet in it's service method?
if yes,what would be the effect and if no why?


Did you try calling it? What happened?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!