Oracle ADF Faces Cookbook
上QQ阅读APP看书,第一时间看更新

Creating a View page

In this simple recipe, we will create the actual JSF page behind the Employees View activity inside the retrieve-employees-information task flow that was created in the previous recipe.

How to do it…

In order to create the JSF page behind the View activity, follow the ensuing steps:

  1. Open the retrieve-employees-information task flow and then double-click on the employees View activity. A dialog should pop up asking for the filename and the page template for this page and/or Managed Beans for it. For this simple application, we won't create page templates as we will use Oracle Three Column Layout.
  2. Leave the default filename as is.
  3. Choose the Oracle Three-Column layout under Page Layout tab | Reference ADF Page Template. In Chapter 5, Beautifying Application Layout for Great User Experience, we will learn how to create our own rich page template.
  4. Close the pop-up window by clicking on the OK button.
  5. Open the HelloADFFaces Overview tab and check the Design Pages checklist item as done.
    How to do it…

The page should be opened automatically, but if it isn't, you can open employees.jsf by navigating to Applications Pane | ViewController | Web Content. You can see that the Oracle three-column template is loaded, and you are able to see the main structure of the page.

How it works…

When you create a page, you have two options:

  • Creating a .jsf page (recommended since 11g Release 2) that uses Facelets
  • Creating a .jspx page, which is given for backward compatibility with JDeveloper release 1 so that you can have a seamless migration from 11gR1 to 12c

You are also asked to choose a page template, which is a great way to have a page structure that can be applied to your pages, without having to worry about maintaining it for each page separately. You can also have a single point of change that can be applied to all the pages that use this template. JDeveloper and ADF come with the Oracle three column template that can be used.

While creating this page, we reached a status where we can run and display what we've done; however, the page is currently empty and we want to have the employees' data, so first let's place some components on the page before running it.