Oracle ADF 11gR2 Development
Experience the easiest way to learn, understand,
and implement rich Internet applications using
Oracle ADF 11gR2
BIRMINGHAM - MUMBAI
Oracle ADF 11gR2 Development Beginner's Guide
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be
caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2013
Production Reference: 1180413
Published by Packt Publishing Ltd.
35 Livery Street
Birmingham B3 2PB, UK.
Cover Image by Suresh Mogre (email@example.com)
Sten E. Vesterli
Lead Technical Editor
Tejal R. Soni
About the Author
Vinod Krishnan has over eight years' experience in the Information Technology industry
this exposed him to a wide range of technologies that include Java, J2EE, WebLogic, Fusion
Middleware, SOA, and Webcenter.
He has been working with Oracle ADF Technologies since 2005, and enhanced his affinity
towards ADF after he joined Oracle India. For the last five years, Vinod is actively involved
in large implementations of next-generation enterprise applications, utilizing Oracle's
JDeveloper and Application Development Framework (ADF) technologies. He holds a
B.Tech. in Information Technology from Anna University, Chennai, India.
He is currently responsible for building and deploying applications using the Oracle Fusion
Middleware technology stack as a Project Lead in Oracle America.
He is an Oracle Certified Specialist, and the technologies he has worked on
include Oracle ADF, SOA, Webcenter, and Identity Management. His contribution towards
Jdeveloper and ADF discussion forums is immense. With his experience, he has learned
many tips and techniques that will help a new user to learn this technology without any
hassles. He writes his own blog (http://vtkrishn.com) that discusses the tips and tricks
with using Oracle technologies.
Vinod has had a multifaceted career, he has worked in positions such as Senior Consultant,
Senior Applications Engineer, Software Engineer, and Solution Architect for MNCs such as
Oracle, Capgemini, and Keane. Currently he is working as a Project Lead in Oracle America.
I would like to express my gratitude to the people who saw me through this
book, to all those who provided support, talked things over, read, wrote,
offered comments, allowed me to quote their remarks, and assisted in the
editing, proofreading, and design.
I want to thank my wife, Sandhya, who supported and encouraged me in
spite of all the time it took me away from her. It was a long and difficult
journey for her.
I would like to thank Grant Mizen, Stephanie Moss, Ameya Sawant, and
Poonam Jain for helping me with the process of selection and editing.
Thanks to Packt Publishing for giving me the opportunity to help and
guide new users of ADF with my book.
About the Reviewers
Frank Nimphius is a Senior Principal Product Manager in the Oracle application development
tools group at Oracle Corporation, specializing in Oracle JDeveloper and Oracle Application
Development Framework (ADF).
In his current position, Frank represents and evangelizes the Oracle JDeveloper and Oracle
ADF products worldwide as a speaker at user group and technology conferences as well as
in various publications. Frank runs the ADF Code Corner website, the "OTN Forum Harvest"
blog, and is the co-author of the Oracle Fusion Developer Guide book published in 2009 by
Sten E. Vesterli took up Oracle development as his first job after graduating from the
Technical University of Denmark, and hasn't looked back since. He has worked with almost
every development tool and server Oracle has produced in the last two decades, including
Oracle ADF, JDeveloper, WebLogic, SQL Developer, Oracle Portal, BPEL, Collaboration Suite,
Designer, Forms, Reports, and even Oracle Power Objects.
He started sharing his knowledge with a conference presentation in 1997 and has since
given more than 100 conference presentations at Oracle OpenWorld and at ODTUG, IOUG,
UKOUG, DOAG, and other user group conferences around the world. His presentations are
highly rated by the participants, and in 2010 he received the ODTUG Best Speaker award.
He has also written numerous articles, participated in podcasts, and has written Oracle Web
Applications 101, McGraw-Hill, and Oracle ADF Enterprise Application Development – Made
Simple, Packt Publishing. He is currently writing his third book on Oracle ADF Essentials.
Oracle has recognized Sten's skills as an expert communicator on Oracle technology by
awarding him the prestigious title of Oracle ACE Director, which is carried by less than
100 people in the world. He is also an Oracle Fusion User Experience Advocate and sits
on the Oracle Usability advisory board, and he is part of the Oracle WebLogic Partner
Council as well.
Based in Denmark, Sten is a partner in the Oracle consulting company Scott/Tiger, where
he works as a Senior Principal Consultant. When not writing books or presenting, he helps
customers choose the appropriate technology for their needs, teaching, mentoring, and
leading development projects. In his spare time, Sten enjoys triathlon and completed his
first Ironman in 2012.
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and
as a print book customer, you are entitled to a discount on the eBook copy. Get in touch
with us at firstname.lastname@example.org for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can access, read and search across Packt's entire library of books.
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine entirely free books. Simply use your login credentials for
Table of Contents
Chapter 1: Installing and Configuring JDeveloper IDE
System requirements for Windows
Time for action – downloading the installer
Time for action – installing JDeveloper Studio Edition
Time for action – launching JDeveloper for the first time
Knowing the start-up flags/parameters
Time for action – setting the start-up options
Setting up the user directory (System directory)
Working with IDE configuration files
Knowing the roles
Getting familiar with the IDE
Setting the preferences
Knowing the IDE components
Time for action – opening the sample application
Data Controls palette
Recently Opened Files
The Resource palette
Time for action – creating a catalog
The Component palette
The Log window
Table of Contents
Code editor views
Chapter 2: Getting Started with ADF
How ADF implements MVC
The ADF architecture
Creating a simple application in ADF
ADF development practice
Sample application – employee directory application
Time for action – creating the application workspace
Planning your application
Connect to a database
Time for action – setting up the database tables
Time for action – creating a database connection
Build business services
Accessing the project properties
Time for action – creating the business components
Running the AM tester
Exposing data to the UI layer
Time for action – bind data to the UI components
Time for action – running the application
Chapter 3: Understanding the Model Layer
ADF business components
What is an entity object?
Time for action – checking the attributes of an entity object
Time for action – creating an entity object for DEPT table
Time for action – creating an association between EmpEO and DeptEO objects
About the view object
Types of view object
Time for action – creating an entity-based view object
Importance of a view link
Time for action – creating a view link between EmpVO and DeptVO
What is an application module?
Time for action – creating an application module
Time for action – adding the view link to the application module
Business components in action
[ ii ]
Table of Contents
Time for action – running the application module
Options for the business components
Chapter 4: Validating and Using the Model Data
Knowing the lifecycle of an entity object
Types of validation
Built-in declarative validators
Time for action – adding a collection validator for the DeptEO file
Time for action – creating an alternate key for DeptEO
Setting a default value
Time for action – setting a default salary for employees
Some commonly used expressions
Time for action – adding a script expression
Learning about APIs
Generating an entity implementation class
The Compare validator
The Key Exists validator
The Length validator
The List validator
The Method validator
The Range validator
The Regular Expression validator
The Script validator
The UniqueKey validator
Java classes in entity objects
[ iii ]
Table of Contents
Time for action – generating a Java API for DeptEO
Application module API
Time for action – learning to override a method
Time for action – creating configurations
Time for action – exposing a method using the client interface
Classes for view objects
Chapter 5: Binding the Data
ADF model layer
Data Controls palette
The view object collection
Time for action – adding a Commit button to the UI page
Working with the data control layer and binding
Time for action – accessing the page definition file
Creating the bindings manually
Time for action – creating page definition bindings
Chapter 6: Displaying the Data
Oracle Three Column Layout
Oracle dynamic tabs shell
Creating a page
Knowing the page template
Time for action – creating the page template
Creating the page with the template
[ iv ]
Table of Contents
Time for action – creating the dept.jspx file
Layout the page display
Time for action – creating the layout for the page
Knowing the UI components
Time for action – showing a popup to the user
List of values components
Data visualization components
Table of Contents
Time for action – adding an EL expression
Partial page rendering
Chapter 7: Working with Navigation Flows
Task flow types
Unbounded task flow
Bounded task flow
Time for action – adding a bounded task flow to EmpDirectoryApplication
Task flow components
Time for action – adding a method call activity
Time for action – adding a Task Flow Return
Time for action – adding a View activity to the task flow
Save Point Restore
Task Flow Call
Task Flow Return
Task flow options
Based on a template
Time for action – passing parameters to a task flow
Task flow as a region
Time for action – adding a task flow as a region
ADF life cycle
Relationships between the scopes
Chapter 8: Layout with Look and Feel
What is a skin?
Time for action – adding a skin file to the application
[ vi ]
Table of Contents
Pseudo classes in the ADF skinning framework
Using the skin editor
Time for action – creating an ADF skin using the skin editor IDE
Global selector aliases
Faces component selectors
Time for action – deploying the skin file
Chapter 9: Implementing Security
Chapter 10: Deploying the ADF Application
Introduction to security
Time for action – implementing basic security
Applying security permissions
Security for business objects
Security for task flows and page-related files
Time for action – adding permissions
Creating a login page
Time for action – creating a login page
Creating roles and groups
Time for action – creating roles and assignments
Disabling ADF security
Time for action – disabling security for ADF applications
ADF application deployment
Preparing for deployment
Time for action – creating the deployment profile
[ vii ]
Table of Contents
Deployment to the WebLogic server
Time for action – creating a default domain for integrated server
Time for action – deployment to integrated server
Time for action – deploying to the standalone server
Chapter 11: Advanced Features of ADF
Advanced topics on entity objects
A resource bundle
Business logic groups
The Custom validation rule
Custom error messages
Advanced topics on view objects
Avoid getRowCount, getEstimatedRowCount
Working with Rowsets
List of values
Time for action – creating a list of values of a department
Application module state management
Complex data controls
Complex task flows
Time for action – publishing an event and subscribing it
Complex usage of a managed bean
Debugging the application
Debugging the lifecycle
The Metadata Services framework
The Active Data Services framework
The ADS framework
[ viii ]
Table of Contents
Modes of data transport
WebLogic server configurations
The Security realm
Creating an extension
The extension.xml file
Time for action – creating and running an extension
Pop Quiz Answers
[ ix ]
Application Development Framework (ADF) 11gR2 is the next-generation JEE framework
from Oracle for building robust and scalable enterprise applications. ADF 11gR2 provides
out of the box infrastructure solutions that simplify application development and end user
experience. Application development using ADF 11gR2 is fun as it provides a visual and
declarative development experience. Some of the noted features offered by ADF 11gR2
are rich and powerful components support for rich Internet applications, Page Flow 2.0
support, drag-and-drop support for data bindings, ADF business components support,
mobile development support, security implementation support, declarative development
support, runtime customization, reusability support, and so on.
Oracle ADF 11gR2 Development Beginner's Guide aims to provide step-by-step instructions for
designing, developing, and deploying a highly scalable, secured, and rich Internet application.
This book will help any user with basic programming skills to quickly learn what options are
available, and how to develop web applications using ADF 11gR2. This book has been designed
to help you learn basics and have fun while developing practical applications using ADF 11gR2.
In this book, you will learn about developing web-based applications using ADF 11gR2
in a simple and easy way. Screenshots and practical instructions are included to make the
book more interactive. This book will serve as a faithful friend to its readers.
What this book covers
Chapter 1, Installing and Configuring JDeveloper IDE will teach you how to install and
configure the JDeveloper IDE, and how to work with the IDE.
Chapter 2, Getting Started with ADF will teach you the basics of the Model-View-Controller
architecture, how ADF fits into the MVC pattern, the components of ADF, and how to
build a simple ADF application.
Chapter 3, Understanding the Model Layer will teach you about ADF Business Components,
how they work, and it will help you familiarize with the components.
Chapter 4, Validating and Using the Model Data describes how to write business logic
declaratively. Learn groovy expressions, and how to manage transactions and expose
Chapter 5, Binding the Data teaches you how to use the data controls and bind the data
for the user interface.
Chapter 6, Displaying the Data shows how to display the data in the UI using layers
Chapter 7, Working with Navigation Flows describes how to use page flows and activities,
pass parameters, and about the ADF life cycle.
Chapter 8, Layout with Look and Feel will teach you how to style the page and make
Chapter 9, Implementing Security will help in securing the page that you have created,
and show how to allow and restrict access for different roles and groups.
Chapter 10, Deploying the ADF Application will help you deploy the application to
Chapter 11, Advanced Features of ADF delves into the Advanced features of the ADF
What you need for this book
You will need a computer running either the Windows or Linux or Mac operating system with
a minimum of 2 GB of RAM. A minimum of 1024 x 768 resolution is desired for development.
It will be good if you have a minimum of 3 GB of hard drive space in your machine. These
requirements are detailed in Chapter 1, Installing and Configuring JDeveloper IDE. An Internet
connection is required to download the files. You should have modern browsers such as
Internet Explorer, Firefox, or Chrome installed on your machine to test the application.
Who this book is for
The book is intended for beginners who know a little bit of HTML and Java programming and
would like to learn how to develop rich web applications using Oracle ADF 11gR2.
In this book, you will find a number of styles of text that distinguish between different
kinds of information. Here are some examples of these styles, and an explanation of
Code words in text are shown as follows: " Accept the prompt to save
jdevstudio11123install.exe on your machine "
A block of code is set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)
Any command-line input or output is written as follows:
# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: "clicking the Next button
moves you to the next screen".
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to
develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to email@example.com,
and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your
account at http://www.packtpub.com. If you purchased this book elsewhere, you can
visit http://www.packtpub.com/support and register to have the files e-mailed directly
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you would report this to us. By doing so, you can save other
readers from frustration and help us improve subsequent versions of this book. If you find
any errata, please report them by visiting http://www.packtpub.com/submit-errata,
selecting your book, clicking on the errata submission form link, and entering the details
of your errata. Once your errata are verified, your submission will be accepted and the
errata will be uploaded on our website, or added to any list of existing errata, under the
Errata section of that title. Any existing errata can be viewed by selecting your title from
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt,
we take the protection of our copyright and licenses very seriously. If you come across any
illegal copies of our works, in any form, on the Internet, please provide us with the location
address or website name immediately so that we can pursue a remedy.
Please contact us at firstname.lastname@example.org with a link to the suspected
We appreciate your help in protecting our authors, and our ability to bring you
You can contact us at email@example.com if you are having a problem with any
aspect of the book, and we will do our best to address it.