Skip Headers
Oracle® Fusion Middleware Java EE Developer's Guide for Oracle Application Development Framework
11g Release 1 (11.1.1.4.0)

Part Number E16272-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

1 Introduction to Building Java EE Web Applications with Oracle ADF

This chapter describes the architecture and key functionality of the Oracle Application Development Framework (Oracle ADF) when used to build a web application with session and entity beans that use EJB 3.0 annotations and the Java Persistence API (JPA), along with ADF Model, ADF Controller, and ADF Faces rich client. This chapter also discusses high-level development practices.

This chapter includes the following sections:

1.1 Introduction to Oracle ADF

The Oracle Application Development Framework (Oracle ADF) is an end-to-end application framework that builds on Java Platform, Enterprise Edition (Java EE) standards and open-source technologies to simplify and accelerate implementing service-oriented applications. If you develop enterprise solutions that search, display, create, modify, and validate data using web, wireless, desktop, or web services interfaces, Oracle ADF can simplify your job. Used in tandem, Oracle JDeveloper 11g and Oracle ADF give you an environment that covers the full development lifecycle from design to deployment, with drag and drop data binding, visual UI design, and team development features built in.

Figure 1-1 illustrates where each ADF module fits in the web application architecture. The core module in the framework is ADF Model, a declarative data binding facility that implements the JSR-227 specification. This specification provides an API for accessing declarative data binding metadata (for more information, see http://jcp.org/en/jsr/summary?id=227). The ADF Model layer enables a unified approach to bind any user interface to any business service, without the need to write code. The other modules that make up the application technology stack aside from EJBs, are:

Note:

In addition to ADF Faces, Oracle ADF also supports using the Swing, JSP, and standard JSF view technologies. For more information about these technologies, refer to the JDeveloper online help. Oracle ADF also provides support for using Microsoft Excel as a view layer for your application. For more information, see the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework

Figure 1-1 Simple Oracle ADF Architecture

Image of ADF architecture

1.2 Developing with Oracle ADF

Oracle ADF emphasizes the use of the declarative programming paradigm throughout the development process to allow users to focus on the logic of application creation without having to get into implementation details. Using JDeveloper 11g with Oracle ADF, you benefit from a high-productivity environment that automatically manages your application's declarative metadata for data access, validation, page control and navigation, user interface design, and data binding.

Note:

This guide covers developing an application with session and entity beans using EJB 3.0 annotations and JPA (Java Persistence API) for model persistence, along with the Oracle ADF Model layer, ADF Controller, and ADF Faces. This process is very similar to developing a Fusion web application. The main difference is that a Fusion web application uses ADF Business Components for the back-end services. When the development process and procedures are the same for both application types, this guide refers you to the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework for that information.

Please disregard any information in the Fusion Developer's guide regarding ADF Business Components (such as entity objects and view objects). For similar information for EJB/JPA, refer to the "Developing EJB and JPA Components" topic in the JDeveloper online help.

At a high level, the declarative development process for a Java EE web application usually involves the following:

1.3 Introduction to the ADF Sample Application

As a companion to this guide, the Suppliers module of the Fusion Order Demo application was created to demonstrate the use of the Java EE and ADF web application technology stack to create transaction-based web applications as required for a web supplier management system. The demonstration application is used to illustrate points and provide code samples.

Before examining the individual components and their source code in depth, you may find it helpful to install and become familiar with the functionality of the Fusion Order Demo application. See the following sections of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework for information:

1.3.1 Running the Suppliers Module of the Fusion Order Demo Application

The Suppliers module consists of a business services project named Model and a web user interface project named ViewController. You run the Suppliers module of the Fusion Order Demo application in JDeveloper by running the ViewController project. The ViewController project uses JavaServer Faces (JSF) as the view technology, and relies on the ADF Model layer to interact with the EJBs in the Model project. To learn more about the Suppliers module and to understand its implementation details, see Section 1.3.2, "Taking a Look at the Supplier Module Code" and Section 1.3.3, "Touring the Supplier Module."

To run the Suppliers module of the Fusion Order Demo application:

  1. Download and install the Fusion Order Demo application as described in the "Setting Up the Fusion Order Demo Application" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  2. Open the application in Oracle JDeveloper:

    1. From the JDeveloper main menu, choose File > Open.

    2. Navigate to the location where you extracted the demo ZIP file to and select the SupplierModule_2.0.jws application workspace from the SupplierModule directory. Click Open.

      Figure 1-2 shows the Application Navigator after you open the file for the application workspace. For a description of each of the projects in the workspace, see Section 1.3.2, "Taking a Look at the Supplier Module Code."

      Figure 1-2 The Supplier Module Projects in Oracle JDeveloper

      FOD application project folders
  3. In the Application Navigator, click the Application Resources accordion title to expand the panel.

  4. In the Application Resources panel, expand the Connections and Database nodes.

  5. Right-click FOD connection and choose Properties.

  6. In the Edit Database Connection dialog, modify the connection information shown in Table 1-1 for your environment.

    Table 1-1 Connection Properties Required to Run the Fusion Order Demo Application

    Property Description

    Host Name

    The host name for your database. For example:

    localhost

    JDBC Port

    The port for your database. For example:

    1521

    SID

    The SID of your database. For example:

    ORCL or XE


    Do not modify the user name and password fod/fusion. These must remain unchanged. Click OK.

  7. In the Application Navigator, right-click Model and choose Rebuild.

  8. In the Application Navigator, right-click ViewController and choose Run.

    The login.jspx page is displayed. Because of the way security is configured in this module, you must first log in.

  9. Enter SHEMANT for User Name and welcome1 for Password.

Once you log in, the browse page appears, which allows you to search for products. Once you select a product in the results table, you can edit or remove the product information. Using the command links at the top of the page, you can edit the corresponding supplier's information, or add a new supplier. For more information about the Suppliers module at runtime, see Section 1.3.3, "Touring the Supplier Module."

1.3.2 Taking a Look at the Supplier Module Code

Once you have opened the projects in Oracle JDeveloper, you can then begin to review the artifacts within each project. The Model project contains the Java classes and metadata files that allow the data to be displayed in the web application. The oracle.fodemo.common project contains components used by multiple classes in the application. The oracle.fodemo.supplier project contains the components used to access the supplier data. Figure 1-3 shows the Model project and its associated directories.

Figure 1-3 The Model Project in JDeveloper

Directories in the Model project

The ViewController project contains the files for the web interface, including the backing beans, deployment files, and JSPX files. The Application Sources node contains the code used by the web client, including the managed and backing beans, property files used for internationalization, and the metadata used by Oracle ADF to display bound data. The Web Content node contains web files, including the JSP files, images, skin files, deployment descriptors, and libraries. Figure 1-4 shows the ViewController project and its associated directories.

Figure 1-4 The ViewController Project in JDeveloper

Directories in the ViewController project

1.3.3 Touring the Supplier Module

The Supplier module contains eight main pages that allow a user to perform the following functionality:

  • Search for products: The browse.jspx page allows a user to search for products. Search results are displayed in a table. Figure 1-5 shows the search form on the browse page.

    Figure 1-5 Search Form in Supplier Module

    Search form in supplier module
  • Edit row data in a table: From the table on the browse.jspx page, a user can select a product and choose Update to navigate to the productInfo.jspx page (clicking the product link also navigates to this page). From the table, a user can also click Remove, which launches a popup that allows the removal of the selected product. Figure 1-6 shows the table on the browse page.

    Figure 1-6 Table on the browse Page

    Table on the browse page
  • Edit row data in a form: From the productInfo.jspx page, a user can change the data for a row. A selection list contains valid values for the product status. The Choose File button allows a user to upload a graphic file, which is then displayed below the form. Figure 1-7 shows the productInfo page.

    Figure 1-7 The productInfo Page

    productInfo page
  • The Add Supplier link takes the user to a series of pages contained within the regisrationDetails.jspx page that are used to create a new supplier, as shown in Figure 1-8.

    Figure 1-8 Create a Supplier Train

    Create a Supplier train
    • For information about creating a train, see the "Creating a Train" section of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

    • For information about creating forms that allow users to create new records, see Section 3.7, "Creating an Input Form."

  • Log in to the application: The login.jspx page allows users to log in to the application. For more information, see the "Enabling ADF Security in a Fusion Web Application" chapter of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.