Creating a Servlet

Learn how to create a servlet to map requests coming to localhost.

A servlet is a Java class that can take in a request and return a response. The input to the servlet is a request, and the output is a response. In a web application, we are talking about HTTP requests and HTTP responses. When something is typed in the address bar of a browser, it sends a request to the web server. The web server returns a response based on the request, and the browser displays the page.

So far, we have created a web.xml file that defines a welcome file, player.do, for our web application. When http://localhost:8080 is typed in the browser, the browser creates a GET request and sends it to ...

Access this course and 1400+ top-rated courses and projects.