• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1242
  • Last Modified:

Can we override the init() & destroy() in case of serveltjsp

Can we override the init() & destroy() in case of servelt/jsp?
0
Asheesh_Kumar
Asked:
Asheesh_Kumar
  • 4
  • 2
2 Solutions
 
quincydudeCommented:
Sure you do. They are supposed to be overridden.
0
 
quincydudeCommented:
Remember that when overriding init, include super.init(config) in it as well.
0
 
javaexpertoCommented:
The answer is possibly. The init() method gives you a chance to initialize your servlet before handling any client requests. So if you have initialization code (like getting a database connection or registering yourself with other objects), then you'll override the init() method in your servlet class.

Container calls destroy method to give the servlet  a chance to clean up before the servlet is killed. Like init it's called only once. So rarely you would want to override destroy() method but you can.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
javaexpertoCommented:
I gave the answer. Thanx
0
 
javaexpertoCommented:
it's ok, I didn't understand
0
 
javaexpertoCommented:
What kind of answer is? Sure you do. They are supposed to be overridden.

The only methods to be supposed overridden are doGet or doPost.

I gave a complete answer  
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now