How to use Cookies to persist HTTP Session data

In this tutorial, we will learn how to save and read the HTTP session state in a cookie using Servlets. By utilizing cookies, we can persist session information on the client-side, allowing us to maintain session state even if the user closes the browser or navigates away from the website. This technique can be beneficial … Read more

How to create a start up class for Enterprise application servers

This article discusses how to create a start up class for a Java Enterprise / Jakarta EE compliant application server such as WildFly. There is no concept of start up class for an application server however you can deploy an application which contains a component bound to the deployment life cycle. For example, the javax.servlet.ServletContextListener … Read more

HelloWorld Servlet example

In this tutorial we will learn how to code and deploy an HelloWorld Servlet on the latest version of WildFly. A Java Servlet is a Java object that responds to HTTP requests while running inside a Web container. In terms of process, the browser sends an HTTP request to the Java web server. The web … Read more

Programming Jakarta Servlets

A Servlet is a web based component, managed by a container, that generates dynamic content. Currently, the latest release of Jakarta Servlets is 5.0 (September 7, 2020). Jakarta Servlet version 5.0 is only a change of namespaces. Thus, migrating a Servlet 4.0 project to Servlet 5.0 and above, requires the replacement of the namespace javax.* … Read more

Using Servlet 4.0 on WildFly

Server push is one core improvements in HTTP/2 which is included in Servlet 4.0 This feature aims aims at improving the perceived performance of the web browsing experience. Server push push is enabled to improved perceived browser performance because servers are in a much better position than clients to know what additional assets (such as … Read more

Intra-Servlet Communication

Sometimes you may need that a Servlet hands off its job to another Servlet or JSP. Intra Servlet communication can be done by means of a Dispatcher or by Redirecting the initial request. Dispatching is done by means of Dispatcher object which allows to complete the request without actually redirecting to user to another site, … Read more

Dynamic Servlet Registration

One of the cool features introduces by Java EE 6 is Dynamic Registration of Servlets and Filters at application startup. This can be really useful if you are building your own framework but I guess for developers too can benefit from it. In order to do that, you can use some new methods introduced in … Read more

Rewrite: a Java EE URL rewriting solution

This tutorial will discuss about a cool open-source project named Rewrite which is an URL-rewriting solution for Servlet, JSF, and Java EE. Rewrite offers powerful configuration, flexible extensions, and framework integration.  In order to experience a basic usage of Rewrite you need to add the rewrite-servlet dependency to your Maven projects. Since we will test … Read more