- Servlet technology is used to create web application which resides at server side and generates dynamic web page.
- Could be argued that the term “server” or “servlet” is a bit of an overkill. A more rational and simpler name might be “responder”.
- A servlet spends most of its time hanging around doing nothing, waiting to be sent a request and then responding to it.
- For this reason a servlet has a lifetime:
- initialized
- waits for requests
- responds
- destroyed
- Which implies that it has to be created (and later destroyed) by something else (a framework), that it runs in its own thread or process, and that it does nothing unless asked to.
- And also that, a mechanism must be implemented whereby this “entity” can “listen” for requests.
- For this reason a servlet has a lifetime:
Reference
StackOverflow: What is Java Servlet?