Blog from October, 2013

Struts2-Jsr303-Validation-Plugin 1.0 is available now.

This Plugin works as a bridge between Struts2 and JSR-303 Compliant bean Validator. Some of reference implementation for JSR303 are

  • Hibernate bean validator
  • Apacche Bval

Project Home
Download Plugin

You can use Maven to add plugin in your struts2 application


<dependency>
  <groupId>com.github.umeshawasthi</groupId>
  <artifactId>struts2-jsr303-validation-plugin</artifactId>
  <version>1.0</version>
</dependency>

Once plugin is in your application class path, all you need to extends you jsr303 and you will be ready to use JSR303 Validator.

<package name="default" extends="jsr303">
    <default-interceptor-ref name="jsr303ValidationStack"/>
    // action mapping
 </package>

Please note that you need to add Bean validator in your application.You can add Hibernate bean Validator or Apache BVal either downloading from there download page or with help of Maven

Hibernate Validator

<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>4.3.1.Final</version>
</dependency>

Apache BVal

<dependency>
   <groupId>org.apache.geronimo.specs</groupId>
   <artifactId>geronimo-validation_1.0_spec</artifactId>
   <version>1.1</version>
</dependency>
 <dependency>
    <groupId>org.apache.bval</groupId>
     <artifactId>org.apache.bval.bundle</artifactId>
     <version>0.5</version>
 </dependency>