What is the correct sequence of steps for handling a client in a Java servlet…
2024
What is the correct sequence of steps for handling a client in a Java servlet as per the lifecycle of a servlet?
- A.
Init method, Service method, doPost/doGet method
- B.
Init method, doPost/doGet method, Service method
- C.
Service method, doPost/doGet method, Destroy method
- D.
Init method, Service method, Destroy method
- E.
Question not attempted
Attempted by 53 students.
Show answer & explanation
Correct answer: D
The standard servlet lifecycle is initialization, request servicing, and destruction. Therefore the sequence is init method, service method, and destroy method.