In this example you will see how to validate a Spring MVC form. To validate the form fields all you need to do is create a *validator class that implements the Validator interface, override the validate() method to perform all the validations.
Maven configuration
You need the following jar files. So either add this pom.xml file to your application or download and add the jar files to your class-path.
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
modelVersion
>4.0.0</
modelVersion
>
<
groupId
>org.camelcode</
groupId
>
<
artifactId
>Spring-MVC-form-valiation-XML-configuration</
artifactId
>
<
version
>1.0</
version
>
<
properties
>
<
spring.version
>3.0.5.RELEASE</
spring.version
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>org.springframework</
groupId
>
<
artifactId
>spring-core</
artifactId
>
<
version
>${spring.version}</
version
>
</
dependency
>
<
dependency
>
<
groupId
>org.springframework</
groupId
>
<
artifactId
>spring-web</
artifactId
>
<
version
>${spring.version}</
version
>
</
dependency
>
<
dependency
>
<
groupId
>org.springframework</
groupId
>
<
artifactId
>spring-context</
artifactId
>
<
version
>${spring.version}</
version
>
</
dependency
>
<
dependency
>
<
groupId
>org.springframework</
groupId
>
<
artifactId
>spring-webmvc</
artifactId
>
<
version
>${spring.version}</
version
>
</
dependency
>
</
dependencies
>
</
project
>
No comments:
Post a Comment