This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP FAQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP FAQ" Watch "JSP FAQ" New topic


KumarLalit Gupta

Joined: Apr 11, 2006
Posts: 1
Can i use finalize() method instead of jspDestroy()
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
Yes, you can always use finalize as it's a public method in Object and since a method cannot be overwritten to have a stricter access modifier, you can always use it.

The real Question is: Do you want to? That answer is NO. This is because you could inadvertantly prevent the execution of other code provided by the container necessary for proper cleanup of the JSPs Super Classes and wind up with a lot of unnecessary Objects in your container everytime a JSP is redeployed. A good rule of Thumb is to only use the Super Class methods in JSPs (And most APIs) that the documentation tells you to.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: JSP FAQ
It's not a secret anymore!