Programming Thoughts
Struts 2 - Annotation-based Validation
Duplicate Parameter Names Example
Analysing a Struts 2 feature
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 but it leaves multiple request parameters with the same name to manual code. Alas, Struts 2 doesn't properly work with those either. This article describes an example to illustrate this. 2 handles it.
Live example
A demonstration application can be accessed here. The start page looks like the following.
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 example12.war. Copy that into
your Jakarta server run the /example12 URL.
Next part
Continued in Fixing Duplicate Parameter Names.