Posts

The Problem with Teaching Java

  For many years, Java was often taught by focusing on the tools rather than on the underlying concepts. A student might learn: Applets Swing JSP Servlets JDBC In my particular case, my first experience with Java was through an applet. The focus was on demonstrating that Java could run inside a graphical application or a web browser, but not necessarily on understanding broader concepts such as object-oriented design, separation of responsibilities, or application architecture. Because an applet alone does not explain: Class | Object | Responsibility | Collaboration Between Objects | Complete System A student could understand how to create an Applet and override a method such as paint() , but that did not necessarily prepare them to design an enterprise application. At that stage, I still did not fully understand concepts such as: Object-Oriented Programming. Class responsibilities. Separation of layers. Client-server architecture. Data persist...

Why AppDTE Was Built with Servlets and Embedded Jetty

 One of the questions I am often asked is: Why did you build AppDTE using Embedded Jetty instead of Spring Boot? The answer is that the architecture was never driven by the framework. It was driven by the problem that needed to be solved. The Real Challenge When I started developing AppDTE, I was still learning Java web development. At that time, my goal was not to compare frameworks or choose between different Java technologies. The real challenge was implementing the Chilean Electronic Invoicing (DTE) specification. That meant solving problems such as: Generating XML documents according to the SII XML Schemas. Building the TED (Electronic Stamp). Applying XML Digital Signatures (XMLDSig). Validating XML documents. Communicating with the Chilean Internal Revenue Service (SII). Processing responses and document status. Compared to these tasks, the web framework was only a small part of the project. The Evolution of the Project The project evolved over time...

Simplifying Jakarta EE

While simplifying an application originally designed for GlassFish, I discovered that Jakarta EE can be used in a much smaller form than what is commonly presented. It is not necessary to implement the entire enterprise stack. Depending on the problem you are trying to solve, only the required components need to be used to build the application. A Minimal Web Architecture Browser | ▼ Jakarta Servlet | ▼ Service Layer | ▼ JDBC | ▼ Database View Layer Servlet | ▼ Thymeleaf | ▼ HTML Web Server Java Main | ▼ Embedded Jetty | ▼ Servlet Container A Complete Jakarta EE Server GlassFish normally provides a complete enterprise ecosys...

Creating a MySQL Connection Class in Java

Creating a MySQL Connection Class in Java June 19, 2026 When I started learning Java, one of the first tasks was connecting to a MySQL database. To achieve this, it is common practice to create a class responsible for centralizing the connection configuration and providing Connection objects to the rest of the application. Basic Example package com.egga.appvet.includes; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Connection; public class ConexionBD { private static final String URL = "jdbc:mysql://localhost:3306/AppVet"; private static final String USER = "tuusuario"; private static final String PASS = "tupassword@"; public static Connection getConnection() throws SQLException { return DriverManager.getConnection(URL, USER, PASS); } } In this example, three constants are defined: URL : the MySQL database address. U...

Try-with-resources in Java

Try-with-resources: A Solution for Automatic Resource Management in Java Introduction In Java, managing resources such as files, database connections, or sockets requires properly closing them to avoid memory leaks or resource leaks. Traditionally, this was done using finally blocks, but that approach was more verbose and error-prone. Because of this, Java introduced try-with-resources (since Java 7), a simpler and safer way to manage resources. What is try-with-resources? It is a try statement that allows you to declare resources that will be automatically closed when the block finishes. It works with objects that implement the AutoCloseable interface (or Closeable ). Key Features Automatically closes resources when exiting the try block Eliminates the need for finally blocks Reduces boilerplate code Improves...

Replacing Tomcat: Configure Jetty with Spring Boot

 I this article we will learn how to configure Jetty with SpringBoot. I will not use Spring Initializr. Jetty is fast and lightweight, making it ideal for high-performance applications. Being modular, it allows enabling only the necessary components, optimizing resource usage. Jetty efficiently handles high traffic volumes, enabling applications to scale seamlessly. Add Dependencies to pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.egga</groupId> <artifactId>examplejetty</artifactId> <version>0.1</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.s...

Building a Simple Web Form with Jetty and Servlets

In this article, we will learn how to create a small web application using Java, Jetty, Thymeleaf, and Servlets. We will not use frameworks like Spring Boot because our goal is to understand how a web application works. Before beginning, we need the following requirements: Understanding how a web application works Fundamentals of programming Java 11 or higher Knowledge of how Maven works An IDE of your choice In my case, I will use NetBeans. In NetBeans, I will create a Maven Project → Java Application. We need to edit the pom.xml file because it contains the following dependencies: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>     <groupId>com.egga</groupId>     ...