In this chapter, we will cover the following topics:
Validation exists to ensure that the application is robust against all forms of input data. Invalid data can cause unexpected execution errors, break assumptions elsewhere in your application, introduce errors, and even let someone hijack your data to attack your software. Every software should have server-side validation.
In addition, validation on the client side enables quick feedback for the users without a round trip to the server. That means client-side validation is faster and enables the user to fix problems without sending input data to the server. We can say that server-side validation is a must-have and client-side validation is nice to have for every software.
In this chapter, we will learn how to implement Client-side Validation (CSV) with PrimeFaces. PrimeFaces Client Side Validation Framework is the most complete and advanced CSV solution for JavaServer Faces (JSF). It implements an API for JSF validation within the browser. This implementation is compatible with the server-side implementation so that users do not experience different behaviors on the client and server sides. They can use the same standard JSF validators and converters without worrying about implementation details. A few of the other features of PrimeFaces CSV are: