Site icon TestingDocs.com

Java Servlet Architecture

Overview

Let’s learn about Java Servlet Architecture in this tutorial. The Servlet Interface provides a total of five methods. Among the five methods, the three methods are the Lifecycle methods. These methods are discussed in Servlet Lifecycle.

Servlet Architecture

The web server receives the client request issued to the servlet. The server verifies the request and transfers the request to the servlet container.

The servlet container creates a request object, response object, and thread to handle the client request. The container stores the request and response objects in the thread object. For every client request, the container creates a pair of request, response, and thread objects. For example, if the servlet receives 2 client requests, the container will create 2 pairs of the request, response objects, and 2 threads. The multiple threads created by the container share the same OS-level process.

 

 

The thread will invoke the service() lifecycle method of the servlet by passing the request and the response objects as the parameters. The business logic implemented in the service() method would be executed.

The container will provide the response object from the servlet to the web server.

The web server constructs the response data in the form of a web page and serves the page to the client browser. The container will destory the request, request, and thread.

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version