From the course: Java EE: Bean Validation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

✓ Solution

✓ Solution

From the course: Java EE: Bean Validation

Start my 1-month free trial

✓ Solution

(futuristic tonal chiming) - [Instructor] So how did you get on with your challenge? Well, let's have a look at my solution. Well, here is the property file. Now what I've done is to add a custom message for the credit card and the validation. I think it's a good idea to set the credit card number message globally, because throughout the site, validation exception should throw up the same message. So on the client what I've done is to add messages to each of the not nulls. I think this is a good idea because I need to mention the actual field that has failed the validation. So for example here, on the email, what I've done is I've mentioned the actual field name in the message. Likewise, here, and also for the is that true. Also, I've added another message here on not null message on the credit card so that if the credit card is null, it'll prints up a message on the screen.

Contents