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
About the Author
About the Reviewers

Creating a custom converter

When you create a custom converter, this converter will need to run on the server as per the JSF lifecycle.

In this recipe, we will create a custom converter to convert from oracle.jbo.domain.ClobDomain class to java.lang.String class and vice versa, which will be represented by the employee's Biography attribute.

In this recipe, the model has been created for you. You can continue from the previous recipe, or you can grab this project's recipe by cloning the CreatingCustomConverter application from the Git repository.

Getting ready

In order to create a custom JSF converter, we need to perform the following steps:

  1. Create a class that implements the javax.faces.convert.Conveter interface.

  2. Implement the following two methods: getAsObject and getAsString.

  3. Register this class as a converter inside the faces-config.xml file.

  4. Apply the converter on input components.

How to do it…

To know how to create a custom converter, perform the following steps:

  1. Right-click on the ViewController...