Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What are the life-cycle methods for a servlet?
Home
Servlet
What are the life-cycle methods for a servlet?
0
votes
asked
Apr 11, 2023
in
Servlet
by
john ganales
What are the life-cycle methods for a servlet?
servlet
life-cycle-methods
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Apr 11, 2023
by
john ganales
Below
are the life-cycle methods for a servlet
Method
Description
public void init(ServletConfig config)
It is invoked only once when first request comes for the servlet. It is used to initialize the servlet.
public void service(ServletRequest request,ServletResponse)throws ServletException,IOException
It is invoked at each request.The service() method is used to service the request.
public void destroy()
It is invoked only once when servlet is unloaded.
...