Servlets and JSPs

Servlets and JSPs are used for programming web applications. Further explanations will be given in the coming chapters.


Tomcat is a web server and servlet container that allows Java code to be executed in an HTTP web server environment. To use Tomcat, we installed Tomcat 9.0.4 and enabled the JAVA_HOME path. A detailed video showed how to perform these steps. Tomcat provides a practical solution for running Java Servlets and allows to create dynamic content in a web environment.

Get- and Post- Method

Communication between client and server is based on HTTP requests and responses. The client sends a request and receives a response, which may contain HTML. The request contains an HTTP method that informs the server about the nature of the request. The most common methods are Get and Post. Get is used to retrieve data, while Post is used to send data to the server. Choosing the right method is important to perform the desired actions. HTTP enables the exchange of data and the control of communication between client and server.

The following illustrations show a simplified version of the request and the response:

The Get method is a simple call, the Post method can send data from the user. The Get method is therefore a call for a specific resource to be sent. The Post method makes it possible to send resources to the server, which can be stored by the server.

However, the HTTP Get method can send very small amounts of data. Reasons for using post instead of get methods are the following:

Furthermore, the two methods differ in their anatomy, which becomes clear in the following illustrations:

Directory structure of a simple Apache website

A popular open source web server is Apache. In the lecture, we looked at a concrete example, namely the directory structure of a website. Let's take as an example the website, which offers advice on skiing and beer. In this scenario, the web server runs on port 80 and the directory structure of the website is organised accordingly. The web server allows us to host the website and manage access to it.