Defining validation in the ADF View Layer

Defining validation in the ADF View Layer

ADF framework provides ADF Faces validation to add validation rules to an ADF Faces component.

A “validator” attribute is used to create business specific validation rule.

Validator uses el expression to bind method in a managed bean. In this Example, I will explain how to build your own custom validation logic. This example is based on HR schema Employees table and our business rule in phone_number attribute must be 10 digits.

  1. Open managed bean class and create method with following method signature.
    public void methodName(FacesContext, UIComponent, Object){...}
    public void validatePhoneNo(FacesContext facesContext, UIComponent uIComponent, Object value) {
    String pno=value.toString();
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,null,"Phone Number must be 10 digits");
    throw new ValidatorException(message);
  2. In your inputText component bind validator attribute with above managed bean validatePhoneNo method.




  • 2
  • 1

About Manish Pandey

Manish is a Project Leader at Jagran Prakashan Ltd, focused on Jdeveloper Fusion Web Application(specifically Oracle ADF). He shares his knowledge through the OTN Jdev/ADF Forum. He has written more than 50 article about Oracle ADF and Jdeveloper.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.