How To Use Switch Statement (th:switch) In Thymeleaf Template?


In my previous articles I have explained about the hello world example and the expression language. This tutorial explains how to use the switch statements inside Thymeleaf template. Thymeleaf provides th:switch attribute for using switch functionality. This feature is extension of my previous example on iteration in thymeleaf template. 1. Set Up Thymeleaf Application To […]

How to use Enum in Switch?


Enums introduced in Java 5.0 (Read: New features in Java 5.0) allows switching to be done based on the enums values. It is one of the greatest new features introduced from the version 5.0. Prior to Java 1.4, switch only worked with int, short, char, and byte values. However, since enums have a finite set of […]