Programming Thoughts
Struts 2 - Annotation-based Validation
Bespoke Annotation Example
Actually reducing Struts 2's arcane configuration
Struts 2 is a popular MVC framework for Java-based web applications but its annotation-based validation doesn't properly work. So, an alternative was created then redesigned. This article describes a working example of bespoke annotations.
Live example
A demonstration application can be accessed here. The start page looks like the following. It is like example 10 but applies a variety of policies, including some that recognise locale.
Figure 1: Starting page
Download
A demonstration application can be downloaded here as zip files. They require the following.
- JDK 8 or better
- Maven 3
- Jakarta EE server, such as Tomcat 9
Extract the Example 11 files and run mvn, which compiles into example11.war. Copy that into
your Jakarta server run the /example11 URL.