aspose file tools
The moose likes Spring and the fly likes Problem in ValidationUtils Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem in ValidationUtils" Watch "Problem in ValidationUtils" New topic

Problem in ValidationUtils

Anupam Dee
Ranch Hand

Joined: Oct 18, 2010
Posts: 42

I have two fields in Person Class

I want to validate that both the names should be given by the user at the same time

ValidationUtils only gives the method to check on a particular field, how can I validate this?
Bill Gorder

Joined: Mar 07, 2010
Posts: 1681

You can do client side validation using javascript.

Put hibernate validator on your class path.

In your spring controller you can add @Valid to the model object you wish to validate. Then just use the JSR-303 annotations on your fields. Like @NotBlank or @NotNull.

Here is an example.

[How To Ask Questions][Read before you PM me]
subject: Problem in ValidationUtils