Book Image

Oracle ADF Faces Cookbook

By : Amr Gawish, Amr Ismail Gawish
Book Image

Oracle ADF Faces Cookbook

By: Amr Gawish, Amr Ismail Gawish

Overview of this book

Table of Contents (18 chapters)
Oracle ADF Faces Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Adding client-side capabilities to the validator


Adding client-side capabilities to the validator can save a round trip to the server, which can greatly improve performance.

In this recipe, we will add client-side capabilities to the EmailValidator. You can continue from the previous recipe, or you can grab this project's recipe by cloning the CreatingCustomCSValidator application from the Git repository.

Getting ready

In order to add the client-side capabilities to the validator, we need to do two things:

  1. Create a JavaScript version of the validator following the documentations.

  2. Implement the org.apache.myfaces.trinidad.validator.ClientValidator interface and override its methods.

The second step is important since even though we are creating a client-side validator, we need to have server-side code in case someone was trying to mimic a POST. So, we need to extend the original EmailValidator class to support the client-side functionality and add the necessary JavaScript at runtime.

How to do it...