909

Oracle JDeveloper 11g Handbook

  • Upload
    vudien

  • View
    469

  • Download
    71

Embed Size (px)

Citation preview

  • ATTiCA

  • PB Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle JDeveloper 11g Handbook A Guide to Oracle Fusion Web Development

  • ii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    About the AuthorsDuncan Mills is senior director of product management for Oracles Application Development Tools, including Oracle JDeveloper, Oracle Enterprise Pack for Eclipse, Forms, and the ADF Framework. Duncan is currently responsible for product direction, evangelism, and courseware development around the development tools products. He has been working with Oracle in a variety of application development and DBA roles since 1988. For the past fourteen years he has been working at Oracle in both support and product development, spending the last eight years in product management. Duncan is the co-author of the Oracle Press book Oracle JDeveloper 10g for Forms and PL/SQL Developers: A Guide to Web Development with Oracle ADF (McGraw-Hill Professional, 2006).

    For nearly three decades, Oracle, the worlds largest enterprise software company, has provided the software and services that enable organizations to get the most up-to-date and accurate information from their business systems. With over 275,000 customersincluding 98 of the Fortune 100Oracle supports customers in more than 145 countries. For more information about Oracle, visit www.oracle.com.

    Peter Koletzke is a technical director and principal instructor for the Enterprise e-Commerce Solutions practice at Quovera, in Mountain View, California, and has worked in the database industry since 1984. Peter has presented at various Oracle users group conferences more than 250 times and has won awards such as Pinnacle Publishings Technical Achievement, Oracle Development Tools Users Group (ODTUG) Editors Choice (twice), ODTUG Best Speaker, ECO/SEOUC Oracle Designer Award, the ODTUG Volunteer of the Year, and NYOUG Editors Choice (twice). He is an Oracle ACE Director and an Oracle Certified Master. Peter has co-authored seven other Oracle Press books (variously with Dr. Paul Dorsey, Avrom, and Duncan) about Oracle JDeveloper, Oracle Forms and Reports, and Oracle Designer.

    Quovera (www.quovera.com) is a business consulting and technology integration firm that specializes in delivering solutions to the high technology, telecommunications, semiconductor, manufacturing, software and services, public sector, and financial services industries. Quovera deploys solutions that deliver optimized business processes quickly and economically, driving increased productivity and improved operational efficiency. Founded in 1995, the company has a track record of delivering hundreds of strategy, design, and implementation projects to over 250 Fortune 2000 and high-growth middle market companies. Quoveras client list includes notable organizations such as Cisco Systems, ON Semiconductor, New York State, Sun Microsystems, Lawrence Livermore National Laboratory, Seagate, Toyota, Fujitsu, Visa, and Cendant.

    Avrom Roy-Faderman works for Quovera as a Java EE consultant, architect, developer, and instructor, specializing in the Oracle Application Development Framework, as well as an Oracle ACE Director. He is a Sun Certified Programmer for the Java Platform and has acted as lead developer on diverse application projects ranging from e-business and online order systems to health-care provisioning for governmental and private organizations. Hes also a regular speaker at Oracle user group conferences and is the co-author, with Paul Dorsey and Peter Koletzke, of two books: the Oracle9i JDeveloper Handbook and the Oracle JDeveloper 10g Handbook, both from McGraw-Hill and Oracle Press.

    NOTeSample code for the hands-on practices in this book as well as errata are available from the websites mentioned in the Introductions section Websites for Sample Files.

  • ii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle JDeveloper 11g Handbook A Guide to Oracle Fusion Web Development

    Duncan Mills Peter Koletzke Avrom Roy-Faderman

    New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto

  • Copyright 2010 by The McGraw-Hill Companies, Inc. All rights reserved. Except as permitted under the United States Copyright Act of1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system,without the prior written permission of the publisher.

    ISBN: 978-0-07-160239-6

    MHID: 0-07-160239-9

    The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-160238-9, MHID: 0-07-160238-0.

    All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name,we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark.Where such designations appear in this book, they have been printed with initial caps.

    McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training pro-grams. To contact a representative please e-mail us at [email protected].

    Information has been obtained by Publisher from sources believed to be reliable. However, because of the possibility of human or mechani-cal error by our sources, Publisher, or others, Publisher does not guarantee to the accuracy, adequacy, or completeness of any informationincluded in this work and is not responsible for any errors or omissions or the results obtained from the use of such information.

    Oracle Corporation does not make any representations or warranties as to the accuracy, adequacy, or completeness of any information con-tained in this Work, and is not responsible for any errors or omissions.

    TERMS OF USE

    This is a copyrighted work and The McGraw-Hill Companies, Inc. (McGraw-Hill) and its licensors reserve all rights in and to the work.Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copyof the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distrib-ute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for yourown noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if youfail to comply with these terms.

    THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TOTHE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDINGANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLYDISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MER-CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the func-tions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor itslicensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages result-ing therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shallMcGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from theuse of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shallapply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.

  • For Amanda, Josh, Sam, and Hissy.Duncan Mills

    For my folks, Jan and Max.Peter Koletzke

    For Nilakash, a sudden blue sky on a rainy day.Avrom Roy-Faderman

  • This page intentionally left blank

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Blind folio: vi

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Blind folio: vi

    Contents at a Glance

    PART IOverviews

    1 Overview of Fusion Development and ADF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    2 Introduction to the JDeveloper Integrated Development environment . . . . . . . . . 33

    3 JDeveloper Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    4 Technology Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

    PART IIADF Business Components

    5 Introducing ADF Business Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    6 Specifying a Business Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    7 Assembling a Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    8 Providing Custom Data Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

    PART IIIADF View and Controller

    9 JavaServer Faces Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

    10 Your First JSF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

    11 The ADF Controller and Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371

    12 ADF Faces Rich Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

    vii

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    viii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    PART IVADF Model

    13 ADF Model Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

    14 ADF Advanced Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

    15 ADF Bindings: Iterators, executables, and Code . . . . . . . . . . . . . . . . . . . . . . . . . . 537

    PART VDeveloping the Sample Application

    16 Application Design Principles and Sample Application Overview . . . . . . . . . . . . . 567

    17 Sample Application: UI Patterns and Templates . . . . . . . . . . . . . . . . . . . . . . . . . . 597

    18 Sample Application: Search Page and Department Hierarchy Page . . . . . . . . . . . . 627

    19 Sample Application: edit Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667

    20 Sample Application: The Image LOV Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723

    21 Sample Application: Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773

    22 Sample Application: Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821

    ix

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    viii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Contents

    Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiAcknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiiiIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix

    PART I Overviews

    1 Overview of Fusion Development and ADF . . . . . . . . . . . . . . . . . . . . . . . . . . 3What Is Fusion? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    The Origins of Oracle Fusion Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5The Fusion Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    What Is a Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17The Anatomy of a Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18What Characterizes a Good Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    What Is Oracle ADF? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22How Do I Choose Technologies? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23User Interface Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Database Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Why Should I Use JDeveloper? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    2 Introduction to the JDeveloper Integrated Development Environment . . . . . . 33What Are the Important Features of the JDeveloper IDE? . . . . . . . . . . . . . . . . . . . . . . . . 35

    JDeveloper Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36The Main IDE Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Main Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Main Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    How Can I Best Use the Help Center? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Finding the Help Topic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    How Does Source Code Version Control Work in JDeveloper? . . . . . . . . . . . . . . . . . . . 56Working with Subversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Committing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    ix

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    x Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xix Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Adding Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Refreshing a Working Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Version History and Version Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Version Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60State Overlay Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Team Productivity Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    3 JDeveloper Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Application Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Projects Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63Application Resources Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Data Controls Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Recently Opened Files Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    Resource Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67New Gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    Wizards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70Creation Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Application Overview Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Application Overview Panel Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73How Can the Application Overview Window Help? . . . . . . . . . . . . . . . . . . . . . 74

    Structure Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Structure Window Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Structure Window Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Component Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77My Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Property Inspector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78Property Inspector Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

    Log Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Code Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    End Tag Completion and Code Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Code Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Code Insight and Tag Insight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Other Text Editing Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Debugger Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92Running the Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93Debugging PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93Other Tools for Improving Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    JSP/HTML Visual Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Modelers and Diagrammers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Types of Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Creating a UML Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Activity Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98XML Schema Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99JSF Navigation Diagrammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    x Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xix Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    ADF Task Flow Diagrammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100Struts Page Flow Modeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    Database Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100SQL Worksheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101Database Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    4 Technology Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105What Is Java Platform, Enterprise Edition? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    Online References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Java EE Architecture Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108BluePrints and Design Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    What Are the Main Styles of Java EE Code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Application Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112Web Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

    How Do Web Communications Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118HTTP Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118HTTP Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119HTTP Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122The Steps in a Web Application Round-Trip . . . . . . . . . . . . . . . . . . . . . . . . . . . 123Asynchronous JavaScript and XML (AJAX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

    What Languages Do I Need to Know for Web Development? . . . . . . . . . . . . . . . . . . . . 128The Web Development Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128The Level of Knowledge Needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Hypertext Markup Language (HTML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Cascading Style Sheets (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137Extensible Markup Language (XML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Expression Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Groovy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

    PART IIADF Business Components

    5 Introducing ADF Business Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147Why Use ADF BC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    Java Enterprise Design Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148Business Logic Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149Deployment Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150Database Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

    How Do Business Components Use Java and XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . 151What Are the Major Business Components? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    Entity Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xiiixii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    View Link Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160Application Module Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

    Which Components Support the Major Business Components? . . . . . . . . . . . . . . . . . . 164Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Business Logic Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Property Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

    How Can I Visualize My Business Components? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

    6 Specifying a Business Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169What Are Entity Object Definitions and Entity Object Instances? . . . . . . . . . . . . . . . . . 170

    Entity Object XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Entity Object Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Entity Definition Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Entity Collection Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174Custom Framework Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    What Is an Association? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Source and Destination Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Association Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180Compositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

    How Do Entity Attributes Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182Persistent and Transient Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182Attribute Types and Column Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183Working with Built-in Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184Object Type Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Primary Key and Alternate Key Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    How Do You Create and Edit Entity Object Definitions and Associations? . . . . . . . . . . . 186Creating Entity Object Definitions and Associations . . . . . . . . . . . . . . . . . . . . . 186Editing Entity Object Definitions and Associations . . . . . . . . . . . . . . . . . . . . . . 188

    How Do You Implement Attribute-Level Validation? . . . . . . . . . . . . . . . . . . . . . . . . . . . 190Specifying Mandatory Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Specifying Scale and Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Preventing Users from Changing Attribute Values . . . . . . . . . . . . . . . . . . . . . . . 192Attribute-Level Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Adding Validation to Setter Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202Validation Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

    How Do You Implement Entity-Level Validation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206Entity-Level Validation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207Validation in the Entity Object Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

    How Does the ADF BC Validation Cycle Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212The Attribute-Level Validation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212The Nondeferred Entity-Level Validation Process . . . . . . . . . . . . . . . . . . . . . . . 213The Deferred Entity-Level Validation Process . . . . . . . . . . . . . . . . . . . . . . . . . . 214Validation Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xiiixii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    How Do You Implement Attribute Defaulting and Calculation? . . . . . . . . . . . . . . . . . . . 215Attribute Defaulting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216Attribute Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

    How Do You Synchronize with Database Defaulting and Calculation? . . . . . . . . . . . . . 220The DBSequence Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221Other Database Defaulting and Database Calculations . . . . . . . . . . . . . . . . . . . 228

    How Do You Implement Polymorphic Business Rules? . . . . . . . . . . . . . . . . . . . . . . . . . 228Business Logic Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228Polymorphic Entity Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    7 Assembling a Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233What Are View Object Definitions, View Object Instances, and View Rows? . . . . . . . . 234

    View Object XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235View Object Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235View Row Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236View Definition Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237Custom Framework Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

    How Do View Attributes Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238Persistent, SQL-Only, Entity-Derived, and Transient View Attributes . . . . . . . . . 238SQL-Only View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244View Attribute Updatability and Read-Only Entity Object Usages . . . . . . . . . . 244View Attribute Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Key and Alternate Key Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

    How Do You Create and Edit View Object Definitions? . . . . . . . . . . . . . . . . . . . . . . . . . 246Creating View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246Editing View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

    How Do You Specify View Object Queries? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249Normal SQL Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250Declarative SQL Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254Expert SQL Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257Dynamic Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

    How Can View Object Instances Handle Row Creation, Row Deletion, and Association Changes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

    Reference Entity Usages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Creating View Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262Deleting View Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

    What Are View Link Definitions and View Link Instances? . . . . . . . . . . . . . . . . . . . . . . 263Source and Destination Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263View Link SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264View Link Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

    How Do You Create and Edit View Link Definitions? . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Creating View Link Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Editing View Link Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268

    What Are Application Module Definitions and Application Module Instances? . . . . . . . 268Application Module XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268Application Module Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Or eloper 11g Handbook: A Guide to Oracle Fusion eb Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xvxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Application Module Definition Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270Custom Framework Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270How Application Module Instances Implement Their Data Model . . . . . . . . . . 271

    How Do You Create and Edit Application Module Definitions? . . . . . . . . . . . . . . . . . . . 271Creating Application Module Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271Editing Application Module Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273Editing or Creating Configurations for Application Module Definitions . . . . . . . 275

    How Do You Use View Object Instances as LOVs? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277View Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277LOV View Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279Static View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

    How Do Application Module Instances Manage Transactional State? . . . . . . . . . . . . . . 282Locking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282Application Module Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

    8 Providing Custom Data Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285What Sort of Method Can Be a Service Method? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287How Do You Expose Methods as Service Methods? . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

    Client Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288Adding Methods to Client Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

    How Do You Implement Single-Row Methods? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290How Do You Implement Query-Level Methods? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

    Retrieving View Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292Navigating Through the Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295Creating and Deleting Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296Modifying Queries and Filtering Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

    How Do You Implement Cross-Query or Transaction-Level Methods? . . . . . . . . . . . . . . 299Finding View Object and Nested Application Module Instances

    in the Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Creating and Removing View Object Instances Dynamically . . . . . . . . . . . . . . 300Creating and Removing Master-Detail Relationships Dynamically . . . . . . . . . . 302Manipulating Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

    PART IIIADF View and Controller

    9 JavaServer Faces Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309Why Was JSF Developed? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311What JSF Concepts Do I Really Need to Know Now? . . . . . . . . . . . . . . . . . . . . . . . . . . 312

    What Is JSF? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313Runtime Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313JSF-Oriented Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320Designing Cross-Platform Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

    Where Can I Find Additional Information about JSF? . . . . . . . . . . . . . . . . . . . . . . . . . . 325Websites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326Printed Books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT acle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xvxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    10 Your First JSF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327Hands-on Practice: Create a JSF Login and JSF Home Page . . . . . . . . . . . . . . . . . . . . . . 328

    I. Create the Application and a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330II. Diagram the Page Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334III. Create the Login and Home Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336IV. Add Components to the Login Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344V. Add Components to the Home Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354VI. Add Navigation and Validation Logic to the Application . . . . . . . . . . . . . . . 359

    Centralize the Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365Hands-on Practice: Access a Message Bundle with EL . . . . . . . . . . . . . . . . . . . . . . . . . 366Hands-on Practice: Access a Message Bundle with Java . . . . . . . . . . . . . . . . . . . . . . . . 368

    11 The ADF Controller and Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371What Is the ADF Controller and Why Is It Needed? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372

    The Problem with JSF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372Creating a Task Flow Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373About Task Flows and Managed Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374Task Flow Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

    Types of Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389Unbounded Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389Bounded Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390Pages or Fragments? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395More Options on Task Flow Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397

    Advanced Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402Data Control Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402Transaction Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403The Back Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404Coding Around a Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404Debugging Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407

    12 ADF Faces Rich Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413What Is ADF Faces and Where Did It Come From? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

    HTML Render Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415A Very Brief History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416ADF Faces Is Better . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416

    How Does Partial Page Rendering Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417Hands-on Practice: Demonstrate Basic PPR . . . . . . . . . . . . . . . . . . . . . . . . . . . 418

    How Can I Achieve the Perfect Layout? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421Facets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421Knowledge of Layout Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422Nesting Layout Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426Hands-on Practice: Implement an Across and Down Tab Order . . . . . . . . . . . . 427Quick Start Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

    What Types of Atomic Components Are Available? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433Other Atomic Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436Data Visualization Tools (DVT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Or eloper 11g Handbook: A Guide to Oracle Fusion eb Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xviixvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    How Can I Change the Default ADF Faces Appearance? . . . . . . . . . . . . . . . . . . . . . . . . 446Working with Skins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446Working with Component-Level Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449

    How Will I Ever Learn about All These Components? . . . . . . . . . . . . . . . . . . . . . . . . . . 451

    PART IVADF Model

    13 ADF Model Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455What Is the ADF Model Layer? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456

    Data Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457Binding Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457

    How Do You Provide Default or Dynamic Visual Properties for UI Controls? . . . . . . . . 458Control Hints for Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458Control Hints for Bind Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462Control Hints for Lists of Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462

    How Do You Create Data-Bound Pages? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464Using the Data Controls Panel with Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466Drop As Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

    How Do You Create Data-Bound Activities? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485What Files Are Involved in Data Binding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486

    14 ADF Advanced Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489How Can I Edit Data Bindings? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

    Cleaning Up Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492Exploring the Binding Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492

    What Binding Types Are Available? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494Attribute Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495List Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498List of Values Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508Tree Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514Table Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522Action Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524Method Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532Boolean Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

    15 ADF Bindings: Iterators, Executables, and Code . . . . . . . . . . . . . . . . . . . . . . . 537What Is an Iterator? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538

    Editing the Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538Controlling Iterator Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540Types of Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540

    What Are Executables? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541invokeAction Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541taskFlow Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542page Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544searchRegion Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544shuttleRegion Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT acle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xviixvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    How Can I Control Execution in the ADF Model? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546Another Look at Executables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546

    How Can I Override and Add to the ADF Model Life Cycle? . . . . . . . . . . . . . . . . . . . . . 548The ADFm Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549Customizing Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

    What Are Parameters? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554Populating PageDef Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554Advanced PageDef Parameter Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

    What Are Contextual Events? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555A Worked Example of Contextual Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556

    How Can I Write Code Using the ADF Model? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559Access to Data and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559Executing Methods and Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562

    PART VDeveloping the Sample Application

    16 Application Design Principles and Sample Application Overview . . . . . . . . . 567What Is the Design Process for a Fusion Application? . . . . . . . . . . . . . . . . . . . . . . . . . . 569

    System Design Tools and the SDLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569General Application Design Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 572Typical Fusion Page Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575Approaching ADF Business Components Design . . . . . . . . . . . . . . . . . . . . . . . 576

    What Best Practice Should Be Adopted? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579Use Framework Buffer Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579Use Java Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581Stick to JSF and Only JSF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581Create a Custom Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581

    What Is the Design of the Sample Application? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584

    What Do I Have to Think about Before Starting? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587Application Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587Source Control? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593Auditing and Code Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594

    17 Sample Application: UI Patterns and Templates . . . . . . . . . . . . . . . . . . . . . . . 597I. Prepare the Application Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599II. Prepare the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602

    Create a Database Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603Modify the Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606Alter the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610

    III. Set Up Project Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612Create Model Framework Superclasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612Set Up ViewController Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613Declare the Applications Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xviii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Or eloper 11g Handbook: A Guide to Oracle Fusion eb Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xixxviii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    IV. Define a JSF Page Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615Create the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615Add Boxes and Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617Define a Menu and Popup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621Define the Named Content Area of the Template . . . . . . . . . . . . . . . . . . . . . . . 623Test the Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623Fix the Copyright Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625

    18 Sample Application: Search Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627I. Prepare Employee Search Business Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629

    Set Up Entity Object Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630Create the Employees View Object Definition . . . . . . . . . . . . . . . . . . . . . . . . . . 632Define Named View Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633

    II. Create the Search Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635III. Create the Employee Search Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637

    Define the Search Task Flow and Page Fragment . . . . . . . . . . . . . . . . . . . . . . . . 637Refine the Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640Add an Export Capability to the Result Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644Add an Employee Details Popup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645Add an In-Process Indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646

    IV. Create the Hierarchy Viewer Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648Set Up Hierarchy Node View Object Definitions . . . . . . . . . . . . . . . . . . . . . . . 648Create the Hierarchy Task Flow and Page Fragment . . . . . . . . . . . . . . . . . . . . . . 651Explore the Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652Refine the Hierarchy Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654Improve the Department Node Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657Improve the Employee Node Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659Plug the Hierarchy Viewer into the Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662Write a UI Manager to Switch Page Fragments . . . . . . . . . . . . . . . . . . . . . . . . . 662

    19 Sample Application: Edit Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667I. Set Up the Edit Page and Add LOVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669

    Create the Edit Page Fragment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669Add the Department List of Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673Add the Job List of Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674Add the Manager List of Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675

    II. Refine the Salary Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682Add Validation to the Salary Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682Fix the Salary Validation and Change the Salary Format . . . . . . . . . . . . . . . . . . 686

    III. Refine the Commission Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688Add Validation to the Commission Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688Change Commission to a Spin Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690Change the Commission Updatable Property . . . . . . . . . . . . . . . . . . . . . . . . . . 691Clear the Commission Value for Non-Sales Employees . . . . . . . . . . . . . . . . . . . 694

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT acle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xviii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Contents xixxviii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    IV. Refine the Image Field and the Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697Display the Employee Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697Rearrange the Layout and Modify Some Labels . . . . . . . . . . . . . . . . . . . . . . . . . 698Fix the Forms and the Field Widths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700

    V. Create a Popup for Job History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703Display the Job History in a Popup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704Update the Job History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707

    VI. Apply Final Refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713Define Cascade Delete Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713Add the Biography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714Disable and Enable the Rich Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717Refactor the getBindings( ) Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719Display the Manager Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720

    20 Sample Application: The Image LOV Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . 723I. Change How the Business Components Handle Image Usages . . . . . . . . . . . . . . . . . 727

    Create an Entity Hierarchy for Image Usages . . . . . . . . . . . . . . . . . . . . . . . . . . 727Use the Entity Hierarchy in a View Object Definition . . . . . . . . . . . . . . . . . . . . 729

    II. Create the Popup Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733Create a Task Flow for the Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733Create a Page Template for the Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734Create Page Fragments for the Train Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736Wire the Dialog to the Edit Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736Fix the Popup Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738

    III. Implement the Add Image Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744Lay Out the Form Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744Create a Backing Bean for the Add Image Page . . . . . . . . . . . . . . . . . . . . . . . . . 745Use the Image Component to Preview the Uploaded Image . . . . . . . . . . . . . . . 745Create a Service Method to Add an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747Fix Association Posting Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751Create an Upload Listener to Copy the File and Call the Service Method . . . . . 752

    IV. Implement the Set Default Image Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756Lay Out the Form Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756Create a Backing Bean for the Set Default Image Page . . . . . . . . . . . . . . . . . . . 759Add Drag-and-Drop Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759Create a Service Method to Set the Default Image . . . . . . . . . . . . . . . . . . . . . . 760Implement a Drop Listener to Call the Service Method . . . . . . . . . . . . . . . . . . . 762Add Commit Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765

    V. Integrate the Edit Page with the Rest of the Application . . . . . . . . . . . . . . . . . . . . . . . 766Create a Link from the Search Page to the Edit Page . . . . . . . . . . . . . . . . . . . . . 766Parameterize the Edit Employee Task Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768Restrict the EditEmployee View Object Instances Query

    Using the Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768Pass Parameters to the Edit Employee Task Flow . . . . . . . . . . . . . . . . . . . . . . . . 770

  • xx Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    21 Sample Application: Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773I. Set Up Security for the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775

    Enable ADF Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775Define Application Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777Define a Credential Store for Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778Map Application Roles to Credential Store Roles . . . . . . . . . . . . . . . . . . . . . . . 779

    II. Implement Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780Authorize Access to Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780Create Basic Management Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783Authorize Access to Task Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785Authorize Access to UI Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786

    III. Implement Custom Login Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788Implement a Managed Bean to Handle Login . . . . . . . . . . . . . . . . . . . . . . . . . . 788Create the Login Popup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791Create Menu Options to Log In and Log Out . . . . . . . . . . . . . . . . . . . . . . . . . . 792Implement a Method to Handle Logout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793

    IV. Access Information about the Logged-In User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794Create a View Object Definition to Return User Information . . . . . . . . . . . . . . . 794Display User Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795Allow a User to Edit His/Her Own Records . . . . . . . . . . . . . . . . . . . . . . . . . . . 797

    22 Sample Application: Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799Java Archive Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801I. Set Up a Standalone WebLogic Server for Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802

    Create and Run a WebLogic Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803Run the Oracle WebLogic Server Administration Console . . . . . . . . . . . . . . . . . 806

    II. Configure Application-Specific Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808Define Database Connection Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808Set Up Users and Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811

    III. Deploy the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813Deploy the Application from JDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813Deploy and Install the Application from an EAR file . . . . . . . . . . . . . . . . . . . . . 817

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821

    xxi

  • xx Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Foreword

    have worked as the architect in the tools group at Oracle for the past seven years, with the last three of those years also spent leading the development team. In all that time, we have been driving toward a single vision. Our goal is to create a tightly integrated, highly productive environment for a diverse set of developers building Java-, Java EE, and SOA-based applications. I think

    what we have delivered with JDeveloper and ADF 11g is the realization of that vision.

    As we have been working on building JDeveloper and ADF 11g over the past few years, the rest of the company was getting behind us as well. JDeveloper and ADF 11g are not only a best-of-breed development environment and runtime to build your custom applications, but they are also the basis for all of the new products coming out of Oracle. Oracle WebCenter 11g, Oracle SOA Suite 11g, and the next-generation Fusion packaged applications are all built using the ADF technology using JDeveloper.

    What this means is that the contents of this book will not only get you productive and up to speed on building custom Java and J2EE applications using JDeveloper and ADF, but they will also provide you the necessary skills to build applications with Oracle WebCenter and Oracle SOA Suite 11g, as well as customize and extend Fusion packaged applications. When considering the vast market of Oracle middleware and packaged applications customers, there is a lot of opportunity for anyone with this skillset.

    When thinking about a group of people qualified to write a book on this subject, I cant think of a better balanced team than Duncan, Peter, and Avrom. Duncan has been with Oracle since well before our shift to Java technology and has been a key contributor in helping us build a tool and framework that appeal to developers from a wide variety of backgrounds. Duncan and his product management team have been on the front lines with customers helping them adopt the 11g technology for the past two years.

    I

    xxi

  • xxii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Complementing Duncans internal perspective is Peter, who works as an external consultant in the market. Peter has written four previous books on JDeveloper and is a long-time guru and presenter on the topic. He is widely known as an expert on the Oracle tools and offers a wealth of information and experience from the view of a customer.

    Rounding things off is Avrom. Avrom was previously a documentation writer in the JDeveloper team at Oracle, and one of the most hands-on doc writers I have worked with. Avrom is able to get deep into the technology, and then use his skills as a writer to clearly articulate to the reader on how things work.

    We are very proud of the Oracle JDeveloper and ADF 11g release and are eager for more and more people to get their hands on it and try it out. Whether you are coming from a background of Java, Oracle Forms, PeopleTools, C/C++, or the scripting world, I think you will find this book and the technology it describes very approachable and powerful in helping you build applications.

    Ted Farrell Chief Architect & SVP, Tools & Middleware

    Oracle Corporation

    xxiii

  • xxii Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    Acknowledgments

    ooks are magical and powerful things. There is something about the handling of the medium and the absoluteness of that old business card or ticket stub that you use as a bookmark that defines your progress and understanding of the subject matter. Although we all have so much information at our fingertips through online documentation and the

    ubiquitous Google, the presence of a well-constructed and linear source of data in the form of a thick wodge of paper adds some undefined quality to the learning process of any technical subject.

    When Peter and I collaborated on our last book back in 2006, we created, I think, a unique resource for the Oracle Development community, and certainly everyone we ever spoke to echoed that sentiment. But times move on, technology changes, and like some kind of primeval migration instinct, the urge to write arose again and here we are. Much has changed in that time, and much has remained the same. I still work for Oracle, although my role and circumstances changed considerably as I uprooted my family five and a half thousand miles from ancient Winchester in England to California. In the course of all this upheaval, I also took on much more management responsibility for the product management and curriculum development teams within the Oracle Tools division. None of which is actually very conducive to freeing up time for writing, but there you go.

    So why do it? Frankly, strange as it may sound, I find this stuff just too exciting. Ive been working with database development tools and Java frameworks for many, many years, and I have to say that JDeveloper 11g and the Application Development Framework have reached a level of maturity and functionality that just blows me away. Already, when I look at the business applications that both Oracle and its customers are creating with the Fusion tools, I see something that sets a standard that the rest of the industry is going to have a hard job catching up with. I just want to rush out and physically shake developers out of their love affair with the 1990s. So this book is, I suppose, a more polite way of doing that.

    B

    xxiii

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Or eloper 11g Handbook: A Guide to Oracle Fusion eb Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    For this book Peter and I are joined by Avrom, a long-time colleague of us both over the years and a hugely valuable addition to the team. Avrom brings a wealth of technical knowledge and possibly more important, practical experience of applying it. One of the roles of the technical book writer is to be an advocate on the readers behalf and to ask the questions that youve not thought of yet, and keep asking them until they get the answer. In this respect Avrom is tenacious, a veritable Canadian Mountie of the technical whys and hows. This book is so much the better for that.

    Peter, as my partner in crime for the last book, and so many joint technical presentations over the years, gets the less dashing comparison with epoxy. If you want to thank any one person for actually getting the book done and holding us together as a team, then Peters your man. Hes organized and herded us through the process, always riding the deadlines and managing the unglamorous tasks of styling and page count. All of this, and still one of the best people I know at expressing deeply technical subjects in a totally accessible manner.

    In an attempt to spread the blame Ill say that a book is only as good as its reviewers, but of course weve had a fantastic review and editing team for the Handbook. Ann Horton took on the monumental task of technical editor at short notice and has done so well. All of these chapter reviewers have donated their own time to make this the book it is: (in no particular order) Dave Schneider, Eric Marcoux, Lynn Munsinger, Frank Nimphius, Shaun OBrien, Grant Ronald, Blaise Ribet. And a special mention must go to Glenn Maslen, who managed the review process for us, and to the review Dream Team of Pam Gamer, Kate Heap, and Patrice Daux, who did such a great job of reviewing Part V of the book in particulara daunting task with preproduction software. Steve Muench, the godfather of ADF Business Components, deserves a big thanks for his help with the sample application where he helped us out of some sticky situations with advice and much patience.

    Thanks to all at Oracle Press, Lisa McClain in particular, who patiently steered us through the whole process yet again and whose understanding of the realities of writing against preproduction software has been invaluable.

    Of course, every book needs a good foreword, and I have to thank Ted Farrell, my boss and the real moving force behind JDeveloper and ADF, for his contribution, vision, and patience over the last two years or so.

    The last word has to be for my family: Amanda, my perfect and understanding wife (did I mention that she is perfect?), Josh and Sam, who gave me the excuse for many hours of writing whilst sitting in the corner at Golden State Taekwondo in San Carlossomewhat different from the traditional coffee shop writing environment, believe me!and finally, of course, little Zo, who kept me company for so many of those early morning writing sessions. Without all of their support this simply would not have happened. Guys, I owe you one.

    Duncan Mills Foster City, CA, USA

    October 2009

    If you compare our signature lines in this acknowledgments section and know our area or do some quick digging, youll find that the California communities in which we authors live form a small triangle, in the center of which is Redwood Shores, the location of Oracle HQ. It would have been nice if this serendipity of geographic proximity had somehow made the collaborative process required for a multi-author book such as this much quicker and easier than any of the other seven Oracle Press books, which Ive co-authored variously with Duncan and Avrom and also with Dr. Paul Dorsey (who, although he was originally signed up for this book, had to bow out early in the process due to work pressures). However, due to a long product incubation slowed somewhat by various corporate acquisitions relatively quick and easy did not happen this time.

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT acle JDeveloper 11g Handbook: A Guide to Or Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxiv Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development Acknowledgments xxv

    Throughout that long (and sometimes hard) process, we had many contributors to this rather large volume without whom you would not be reading this and whom, therefore, Id like to thank. First, Id like to extend my great appreciation to my co-authors, Duncan and Avrom. Im constantly in awe of how they successfully juggle the full-time demands of parenting with full-time IT work and book work. Despite my earlier claims to a long and hard process, I did learned a lot from reading, reviewing, and questioning their material.

    Duncan, thanks again for hosting our FTP server as well as for your insightful and patient mentoring and for inventing and implementing an application that shows off the great new aspects of ADF and JDeveloper in a practical way. Sidebar to Duncan: if you are ever looking for additional employment opportunities as a senior developer/architect . . . well, you know how to get in touch with me.

    I have the pleasure not only of working in the same company as Avrom but also of collaborating with him on client projects. Avrom, thanks for sharing in writing your deep knowledge of ADF internals as well as for sticking with this really long-running project. Id like to take this opportunity to publicly extend my apologies for all my e-nagging about the various deadlines (but you are now two days overdue on your last time report!).

    A large group of others contributed in many ways and now that their work is complete, its a real pleasure to be able to thank them for their effort. Ann Horton, who worked as technical editor for the last book Duncan and I wrote, just happens to be on a team in Oracle that was using JDeveloper 11g (in its pre-production releases) to create applications. We couldnt have asked for a better fit for a technical editor. Thanks, Ann, for your expert insight and patience! Merci beaucoup to Eric Marcoux, our other technical editor and fellow Oracle ACE Director. Eric is also one of the Fusion Middleware 11g early adopters, and his project (outside Oracle) is using the entire technology stack, including JDeveloper 11g. Eric, your comments as a non-Oracle employee working with a real application (also using pre-production software) were very, very helpful.

    My appreciation for additional technical reviews also goes to Rich Bruno, an Oracle consultant whom I work with on a client project at NY State Office of Alcoholism and Substance Abuse Services (OASAS). Rich brought into his reviews a longtime, in-the-trenches knowledge of JDeveloper 9i and 10g and the Oracle database. Rich worked through many of the hands-on practices in their early stages (no small accomplishment there) and gave helpful suggestions for many of the chapters in the book. Our other technical reviewers on the Oracle Product Management side also provided crucial comments and corrections, including information about features I hadnt figured out or known on my own. For those reviews, thanks Patrice Daux, Susan Duncan, Kate Heap, Pam Gamer, Jeff Gallus, Steve Muench, Lynn Munsinger, Frank Nimphius, Shaun OBrien, Blaise Ribet, Grant Ronald, and Dave Schneider for all your valuable input. Also thanks to Glen Maslen for keeping our chapters flowing among the Oracle group. Another thanks to the Oracle JDeveloper documentation team. The early documentation was amazingly complete and helped greatly in learning new features.

    Thanks also go to my boss, Austin Erlich, CEO of Quovera, for the flexibility in scheduling required to balance book work with client work. Id also like to recognize the stellar IT staff at OASAS with whom I have worked for many years for their patience with my erratic work schedule and for helping me stay aware that not everyone in the Oracle development community is fully in tune with all the new aspects of Java (yet). My gratitude also goes to Karen Cannell, Editor-in-Chief of the Oracle Development Tools User Group (ODTUG) Technical Journal, for reviewing an early version of the book for an article in that excellent journal.

    I also appreciate the professionalism and friendliness of the McGraw-Hill staff who helped this book project manifest, especially Lisa McClain, Smita Rajan, Robert Campbell, Janet Walden, Jean Bodeaux, and Jack Lewis with whom we worked directly.

  • Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    Oracle TIGHT / Or eloper 11g Handbook: A Guide to Oracle Fusion eb Development / Mills, Koletzke & Roy-Faderman / 160238-0 Oracle TIGHT / Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development / Mills, Koletzke & Roy-Faderman / 160238-0

    xxvi Oracle JDeveloper 11g Handbook: A Guide to Oracle Fusion Web Development

    As always, Mom, Dad, and Marilyn, thank you for sympathizing with and showing a constant interest in the struggles of the book process.

    Most importantly, thanks to my wife, Anne, for her und