...
Code Block |
---|
|
<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.
Code Block |
---|
|
<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
Code Block |
---|
|
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
</dependency>
|
Apache BVal
Code Block |
---|
|
<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>
|