Java Backend Sviluppo Web

Java Servlet and Apache Tomcat: Complete Course from Scratch with Eclipse

Java Servlet and Apache Tomcat from scratch: HTTP, JSP, MVC pattern, DAO, sessions and endpoint security.

Course description

The Foundation of Java Enterprise Web: Servlet and Apache Tomcat

Before Spring Boot there was the Servlet. Understanding Servlets means truly understanding how Java backend web development works — because Spring is not magic, it's an abstraction built on these fundamentals. This 47-lesson course takes you from HTTP architecture all the way to a complete web application with MySQL, DAO, sessions and endpoint protection.

What You'll Learn

  • Client-Server architecture and HTTP protocol: GET, POST and status codes
  • Install Eclipse and Apache Tomcat and configure them together
  • Create the first Dynamic Web Project and first Servlet
  • Deploy on Tomcat and step-by-step debugging in Eclipse
  • MVC pattern with Servlet as Controller and JSP as View
  • Handling HTML Forms and GET/POST parameter passing
  • Persistence with JDBC and MySQL (MySQL via Docker included)
  • DAO pattern with generic interfaces and SOLID principles
  • ConnectionFactory class and robust connection management
  • RequestDispatcher for routing between Servlet and JSP
  • Cookies and HTTP Sessions: login management and user state
  • Filters for endpoint protection and access control

47 Lessons, One Complete Application

By the end of the course you will have built a Java web application with object insertion, listing and detail views, login with sessions, endpoint protection and MySQL persistence. All without Spring — so when you use Spring Boot, you'll understand what it does for you.

Who It's For

Java developers who want to understand the foundations of Java web development before using frameworks like Spring Boot. Basic knowledge of Java required.

Lessons list

I'll walk you through the theoretical foundations every Java web developer must know: Client-Server architecture and the HTTP protocol. Understanding how client and server communicate is the essential prerequisite before writing your first Servlet.

Guarda lezione

Let's explore what's really inside an HTTP request when you use GET or POST — headers, body, query string, and the full request structure. Understanding this lets you read parameters in a Servlet consciously, not mechanically.

Guarda lezione

I'll show you the technical and conceptual difference between GET and POST, going beyond surface-level theory: security, idempotency, semantics, and when to use each. We'll also analyze the most important HTTP status codes and their meaning in the request-response cycle.

Guarda lezione

Let's install Eclipse IDE for Java Web development and I'll explain what Perspectives are, how to configure them, and why they help you organize your workspace effectively — the first step toward a well-structured development environment.

Guarda lezione

Let's install Apache Tomcat and integrate it directly into Eclipse to run Java web applications locally. I'll explain the role of the Servlet container, how Tomcat works internally, and how to connect it to the IDE for one-click deployment.

Guarda lezione

Let's create the first Dynamic Web Project in Eclipse and write our first Java Servlet from scratch. We'll analyze the project structure, the WEB-INF folder, the web.xml file, and the role of the @WebServlet annotation for URL mapping.

Guarda lezione

I'll show you what actually happens during a Publish to Apache Tomcat: how the server loads the application, makes the Servlet available, and manages the deployment lifecycle. We'll invoke the Servlet from the browser and verify everything works correctly.

Guarda lezione

Let's see how to reach a Servlet from the browser using the GET method, analyzing the URL structure, servlet mapping, and query string parameter handling with request.getParameter() — a key step for understanding the end-to-end HTTP flow.

Guarda lezione

Let's analyze the main lifecycle methods of a Servlet: doGet, doPost, and the constructor, understanding when each is called and how they differ in handling the request. I'll also show you how to test endpoints with Postman to verify behavior without a browser.

Guarda lezione

I'll explain Apache Tomcat's internal architecture clearly: the role of Catalina as the Servlet Container, Coyote as the HTTP Connector, and how Connectors fit into the request lifecycle. Understanding this structure helps you configure and optimize Tomcat with confidence.

Guarda lezione

I'll show you how to send and read parameters in a Servlet using GET and POST — differences between query string and request body, how to use request.getParameter(), and how to handle null values correctly. A practical skill you'll use in every Java web application.

Guarda lezione

Let's see how to debug a Java Servlet using Eclipse's built-in tools: setting breakpoints, inspecting request and response objects, checking parameters and variables at runtime. An essential skill for diagnosing unexpected behavior.

Guarda lezione

I'll introduce the MVC pattern in the context of Java Servlets: the Servlet becomes the Controller, the Model handles data, and the JSP handles presentation. We'll manage a POST request to build a server-side object with properly separated responsibilities.

Guarda lezione

I'll show you how to submit data via an HTML Form to a Servlet and build a Java object server-side step by step from the received parameters. We'll analyze the POST request structure and how to map form fields to Model properties.

Guarda lezione

Let's complete the HTML Form data handling flow: I'll dig deeper into the receiving Servlet, parameter validation with getParameter(), and robust server-side object construction. We'll also handle cases where data arrives incomplete or malformed.

Guarda lezione

Let's start a complete Java Servlet project for inserting and listing objects, integrating Bootstrap for client-side presentation. We'll structure the application following MVC principles with the Servlet as Controller and JSP as View.

Guarda lezione

Let's see how to correctly display an object created from an HTML Form using Bootstrap for a clear, structured presentation. We'll dig into passing data between Servlet and JSP via request attributes and the forward pattern with RequestDispatcher.

Guarda lezione

I'll introduce a server-side static data store to temporarily hold objects created between requests. Then I'll present JSP as a view technology to separate presentation logic from the Controller Servlet, with the first practical examples of dynamic rendering.

Guarda lezione

Let's start using JSP with Scriptlets to access objects coming from the Servlet and display them dynamically on the page. I'll show you the request lifecycle between Servlet and JSP and how to retrieve attributes set on the request.

Guarda lezione

Let's take JSP Scriptlets further to improve dynamic data display, analyzing the limitations of this approach in terms of maintainability and separation of concerns. This lesson prepares you for more structured solutions like JSTL and Expression Language.

Guarda lezione

Let's set up a MySQL database via Docker from scratch — container creation, port mapping, credential configuration, and connection verification. I'll walk you through the steps on both Windows and Mac to have MySQL ready in minutes without local installation.

Guarda lezione

I'll show you how to correctly clone a Dynamic Web Project in Eclipse, replicating structure, configurations, and dependencies without errors. We'll go through each step: classpath management, deployment descriptor, and Tomcat settings in the cloned project.

Guarda lezione

Let's create the SQL database structure and introduce the DAO (Data Access Object) pattern to separate data access logic from application logic. We'll see how this separation improves maintainability, scalability, and testability.

Guarda lezione

Let's design a generic DAO interface applying SOLID's Interface Segregation Principle, building a reusable abstraction for CRUD operations. I'll explain how to split read and write contracts into separate interfaces for a more flexible design.

Guarda lezione

I'll show you how to manually integrate the JDBC MySQL driver into a Dynamic Web Project without Maven — managing the WEB-INF/lib folder, the classpath, and the driver configuration. A hands-on step that shows you what happens under the hood before delegating it to a build tool.

Guarda lezione

Let's design the final DBConfig class to centralize database configuration constants and introduce the ConnectionFactory concept for structured JDBC connection creation. This is the first step toward robust and reusable database connection management.

Guarda lezione

Let's complete the ConnectionFactory implementation, analyzing exception handling, proper resource closing with try-with-resources, and JDBC best practices to ensure stability and consistency in MySQL database connection management.

Guarda lezione

Let's implement the findAll method in the DAO to retrieve all records from the database via JDBC and synchronize the results with the JSP using request attributes and RequestDispatcher. We'll see the full Model → DAO → Servlet Controller → JSP View flow working end to end.

Guarda lezione

Let's complete the CRUD flow by implementing MySQL data insertion via HTML Form and Servlet — parameter reception, validation, DAO call, and PreparedStatement write. I'll also show you how to handle the post-insert redirect to avoid the double submit problem.

Guarda lezione

I'll show you how to convert a Dynamic Web Project to a Maven project while maintaining compatibility with Apache Tomcat and the Servlet architecture — all the steps: creating pom.xml, configuring WAR packaging, and verifying the deployment on Tomcat after conversion.

Guarda lezione

Let's see how to manage Maven dependencies in pom.xml for a Servlet project: including jakarta.servlet-api with provided scope and the mysql-connector-j driver with the correct versions. I'll explain why some dependencies must be declared as provided to avoid conflicts with Tomcat.

Guarda lezione

Let's build the core architecture components: the Model (domain class) and the Service Layer before connecting the database. This approach teaches you to design the application independently of persistence, making it easier to test and maintain later.

Guarda lezione

Let's continue building the Model and Service Layer, defining domain classes and service methods to handle application logic without direct database dependencies. We'll see how this separation keeps the code clean and ready for integration with any persistence layer.

Guarda lezione

I'll introduce the Command Servlet — a central Controller that intercepts all HTTP requests and routes them to the correct business logic using a command parameter. It's a simple but powerful pattern to avoid Servlet proliferation and centralize application routing.

Guarda lezione

Let's dig deeper into RequestDispatcher inside the Command Servlet for managing application routes: routing requests to DAOs and then forwarding to JSPs based on the received command. We'll also structure JSP paths inside WEB-INF to protect them from direct access.

Guarda lezione

Let's implement the user list view using RequestDispatcher to link the Controller Servlet to the JSP view — data retrieval via service and DAO, setting the request attribute, and rendering the Bootstrap table. A code-heavy lesson with a full end-to-end practical example.

Guarda lezione

I'll show you how to implement the user detail view starting from the table link: passing the ID via URL, intercepting the parameter in the Servlet, calling the DAO with findById, and rendering the detail card in JSP.

Guarda lezione

Let's implement new record insertion into the database using the Servlet's doPost method — reading HTML Form parameters, building the Model object, calling the DAO with PreparedStatement, and final redirect via RequestDispatcher. The full CRUD flow in practice.

Guarda lezione

I'll explain what Cookies are in Java Servlets, how they work in the HTTP protocol, and what they're used for to maintain state between stateless requests. We'll see how to create a cookie with new Cookie(name, value) server-side, set its duration with setMaxAge(), and read it in subsequent requests.

Guarda lezione

Let's go deeper into Cookies in Servlets with practical creation, reading, and updating cases: how to iterate request.getCookies(), how to overwrite a value, and how to handle the case where the cookie isn't present yet. We'll also see how to use them for storing lightweight user preferences.

Guarda lezione

Let's see how to read Cookies from the request and use them to dynamically modify the Servlet's output, customizing the HTTP response based on information saved client-side. A practical example of how the server can adapt behavior without sessions.

Guarda lezione

I'll show you how to use Cookies to dynamically modify Servlet behavior with conditional logic: reading the value, branching the response, and customizing the interface based on client-side saved preferences. Practical examples of cookie-based conditional output.

Guarda lezione

I'll explain why Cookies are not suitable for managing security in web applications: client-side manipulation, exposure of sensitive data in the browser, and vulnerabilities like cookie tampering. This module prepares you to understand why a server-side mechanism like HTTP sessions is necessary.

Guarda lezione

Let's dig deeper into Cookie limitations from a security perspective, analyzing real attack scenarios: how a malicious user can modify cookie values and bypass access controls based on them. You'll understand why HTTP sessions are the correct tool for authentication management.

Guarda lezione

I'll introduce HTTP sessions in Java Servlets and show how to use them for login management: creating the session with request.getSession(), saving the authenticated user with setAttribute(), and verifying state between subsequent requests. A secure server-side mechanism for maintaining user identity.

Guarda lezione

I'll introduce Filters in Java Servlets: components that intercept HTTP requests before they reach the Servlet, perfect for implementing cross-cutting access controls. I'll show you how to implement the Filter interface, annotate it with @WebFilter, and use FilterChain to decide whether to block or pass the request.

Guarda lezione

Let's complete the Filter implementation to protect endpoints: blocking unauthorized access, integrating with HTTP sessions to verify login status, and redirecting to the authentication page. We'll see how Filters and sessions work together to build a complete access control system.

Guarda lezione

Servlet REST API con JSON e Jackson: trasformiamo una servlet Java tradizionale in un endpoint HTTP pensato per scambiare dati JSON invece di pagine JSP. Cosa imparerai in questo video: - Come cambia una servlet quando d...

Guarda lezione

GET /api/users con Jackson e Postman: implementiamo il primo endpoint REST in una servlet Java, restituendo una lista di utenti in formato JSON. Cosa imparerai in questo video: - Come eliminare la logica MVC basata su JS...

Guarda lezione

GET by ID in una Servlet REST API: leggiamo l'id dal path della request, restituiamo il dettaglio utente e gestiamo gli errori con una risposta JSON e status 404. Cosa imparerai in questo video: - Come usare getPathInfo...

Guarda lezione

POST JSON in una Servlet REST API: leggiamo il body della request con Jackson, inseriamo un nuovo utente e restituiamo status HTTP corretti come 201 Created e 400 Bad Request. Cosa imparerai in questo video: - Come imple...

Guarda lezione

DELETE in una Servlet REST API: aggiungiamo l'eliminazione di un utente tramite ID, usando il metodo HTTP corretto e status come 204 No Content, 400 Bad Request e 404 Not Found. Cosa imparerai in questo video: - Come imp...

Guarda lezione

PUT JSON in una Servlet REST API: implementiamo l'aggiornamento di un utente leggendo l'ID dal path e i nuovi dati dal body JSON con Jackson. Cosa imparerai in questo video: - Come implementare updateUser nel service - P...

Guarda lezione
Giovanni Pace

Giovanni Pace

Ingegnere Informatico · Pratola Peligna

  • 107 Courses
About the teacher

Sono un ingegnere informatico con oltre 15 anni di esperienza nel settore ICT. Mi occupo di sviluppo software, cybersecurity, data science e intelligenza artificiale, con particolare attenzione all’innovazione e all’automazione dei processi aziendali. Da anni svolgo anche attività di docenza e formazione, creando percorsi pratici e coinvolgenti su programmazione, DevOps, AI e sicurezza informatica.

This course includes

  • Lessons 53
  • Duration 10h 5m
  • Difficulty base
  • Language it
  • Certificate No

Recently viewed