• Implement Validateable and ValidationAware interface in the action class to create custom validations
  • The validate() method of Validateable interface should be overridden to implement custom logic
  • Workflow interceptor is responsible for extracting the defined error details and messages of the action class
  • Field and Action level validations can be implemented by the ValidationAware interface

Example: Action class implementing custom validation logic by overriding the validate()

Struts2 AJAX Validation: json Validation Interceptor

  • To implement AJAX validation use jsonValidation interceptor along with validation interceptor
  • jsonValidationWorkflowStack package contains jsonValidaiton, validation and workflow interceptors and basicstack to implement AJAX Validations

Steps to Implement AJAX Validation

  1. Design input from
  2. Inherit the ActionSupport class in the action
  3. Implement validation in validation.xml file
  4. Define error message
  5. Register jsonValidationWorkflowStack in Validator.xml
    Note: To implement AJAX validation include dojo plugin in your project

Example: Validator.xml with Result and jsonValidationWorkflowStack Interceptor