In this example we will see how to use Annotation based validation in Struts 2.
1. Create a Struts Application
Please download this Struts 2 Validation example to create web application
2. Create an Action class (UserAction.java)
3. Test validations
Compile and run application in tomcat server, we will see below validations upon clicking submit button
1. If user name is blank
2. If user name is less then 4 letters