NOTE

Servlet

Servlet lifecycle: init, service, destroy, garbage collection, and a reference.

JavaCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Lifecycle

  • Call init for initialization.

    It is called only once, when the Servlet is created for the first time.

  • Call service to process client requests.

    This method is called for every client request, and then calls doGet, doPost, and so on.

  • Call destroy to terminate.

    It is called only once.

  • Garbage collection.

Reference

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub