A static web application deliver response to user
what exactly stored in server. The response is always same for all users when
they requested to server. It means static html pages, pdf files and images.

These resources are available in server so that when
the user requested to server and the server will serve as response. The user
will be requested as simple http request to the server so that server will
serve the static recourses as response. To handle request and manage these recourse
we will use web server.

What
is web server?

A web server is server to handle or process the http
request and serve the response to the end users.

We already know http request is simple URL and it
will ask the web server for response on behalf of user.

The popular web server in the market is Apache Web Server.
In the world most of the web servers are Apache Web servers

For example we will request for one html page that
html page contains the company information.

If we observe above request, based on employee Id we
will get different employee information but each time it will execute same
resource in server.

The
following diagram shows the web application in server

In above diagram user send the request to get
employee information and server execute same resource and that recourse get
employee data from information system and give response back to the user.

Who
will produce Dynamic Response?

In dynamic web applications to produce dynamic response
we need special kind of resources and these resources are called helper applications.

Helper application are kind of recourses will be
executes in server to prepare dynamic response. To execute helper applications
we need containers.

Helper application is server side technology to
produce dynamic response based on users demand.

What
is container?

Containers are managing helper applications it means
it will process helper application to produce dynamic response. Processing of
helper application is like execution of helper applications.

Containers are responsible for managing liferay
cycle of helper application when they producing dynamic response. The example
for helper application in Java is servlet

Servlet is helper appellation or server side
component to produce dynamic request to the user.

To execute servlet we need servlet container. The
servlet container is responsible for execution of servlet or manages the life
cycle of servlet when they produce dynamic request.

We have different containers in java like servlet
container, EJB container and JMS container.

Static Web application can be served by Web servers but
dynamic applications cannot so that dynamic web application needs application
servers.

What
is Application Server?

Application server is like web server to handle http
request besides that it will also manage the dynamic applications.

We already know to execute dynamic application we
need containers. Application server has ability to integrate with many containers
like servlet, EJB and JSM containers.

Application server is used to manage dynamic web
application.

We already know we need helper application or
servlet to process dynamic request. To produce dynamic response it will use
some information system for getting the data. Those information systems are
like databases.

Servlet need database to produces dynamic response. The
response is in the form of browser understandable language that is html.

Servlet can produce response in the form of HTML or
other formats like text, images and files formats but all these formats should
understand by browser.

Note:

In the real environment we will use combination of Web
server and Application Server

General
Request flow in Dynamic Web application

The user/client sends the request to the server.

Server will identify the request whether it is
dynamic request or static request.

If static request then web server handle the request
means it will process request and produces the response.

If dynamic request then web server delegates the
request to helper application so that helper application processes the dynamic
request and it will generate the response. Helper application will take the
container help to produce the response.

The response will give to the web server and web
server is responsible to send response to client.

The
following diagram depicts the flow of dynamic request.

In java we will use servlet to process dynamic
request and we use servlet to build dynamic web applications.

What
is servlet?

Servlet is server side technology to produce dynamic
response. Servlet will be executed in servlet containers when they produce
dynamic response. Servlet container will manage the lifecycle of servlet.

Important
Points

We have two different kinds of web applications
static and dynamic.

Static application will be managed by web servers and
dynamic applications are managed by application server.

To produce dynamic response we need helper applications
and these helper application need container to execute and produce response.

Helper application is server side technology and
example in java is servlet.

Application server has ability to accommodate
different container like servlet, EJB and JMS containers.