Extending CSV with Bean Validation

Although the Bean Validation API defines a whole set of standard constraint annotations, one can easily think of situations in which these standard annotations will not suffice. For these cases, you will be able to create custom constraints for specific validation requirements. The Client Side Validation API in PrimeFaces works seamlessly with custom constraints.

In this recipe, we will develop a special custom constraint and validators to validate a Card Verification Code (CVC). CVC is used as a security feature with a bank card number. It is a number with a length between three and four digits. For instance, MasterCard and Visa require three digits, and American Express requires four digits. Therefore, the CVC ...

Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.