Nitesh Kabra
Nitesh Kabra

Reputation: 509

How to Validate text box in spring mvc to enter only digit?

I am creating registration form in spring MVC. There is one Contact number field i bind it with long field value in bean. i want to validate it to enter only digit. i want annotation base validation in spring MVC. any help will be appreciated. I am new in Spring MVC.

Upvotes: 0

Views: 3018

Answers (2)

Stefan Haberl
Stefan Haberl

Reputation: 10539

Spring supports standard JSR-303 Bean validation out of the box. Just follow the very well documented use case within the Spring Reference Documentation

Upvotes: 0

Dangling Piyush
Dangling Piyush

Reputation: 3676

You could use Spring Validations.Here is one nice tutorial for implementing it.In your case you need to implement your own validation logic using in Custom-Validator .Refer this link for some help regarding implementing custom validations.

Upvotes: 1

Related Questions