Java EE 8 Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The Java EE server itself will call doGet() or doPost() methods, depending on the HTTP method used by the caller. In our recipe, we are redirecting them both to the same doRequest() method.

The init() method belongs to the servlet life cycle managed by the server and is executed as a first method after the servlet instantiation. 

The destroy() method also belongs to the servlet life cycle and it's executed as the last method before the instance deallocation.