Developing ADF PageTemplates
In this hands-on, you learn how to create a page template and use this template when creating a new page for your application.

Read more...

Purpose Duration Application

This practice shows you how to develop a page template with layout components that you want to be applied for every single page of your application. Then you see how to create a page using the page template.

The file contains two zip files (tutorial.zip and tutorialsolution.zip), one with the starter application, the other the completed solution.

30 minutes
 
Step 1: Creating a Page Template

In this section you open the starter application and create a page template to be used for additional pages you will create: To create the page template perform the following steps:

Page templates let you define entire page layouts, including values for certain attributes of the page. Read more...

  1. In the Applications Navigator, click Open Application .

  2. In the Open Application(s) dialog, locate the folder where you unzipped the application and select Tutorial.jws. 
    Click Open. If prompted with a migration warning message, continue and finish the migration operation.

  3. The application is loaded up in the Application Navigator, showing the adffacesrc project.

  4. In the Application Navigator, right-click the adffacesrc project and select New from context menu.

  5. In the New Gallery, in the Categories pane, select Web Tier | JSF/Facelets, then select the ADF Page Template item.
    Then click OK.

  6. In the Create ADF Page Template, type simple for the Page Template Name.

  7. In the Facet Definitions tab, click the Add  button and type center as the Name.

  8. Click the Attributes tab, click the Add  button , then type title as the Name and Default Title as the Default Value.
    Then click OK.

  9. The simple.jspx template page opens up in the design editor.

  10. From the Component Palette, expand the ADF Faces - Layout nodes and drag a Decorative Box onto the empty page.

    Using the Property Inspector, in the Style and Theme tab, set the Theme property to light from the list .

  11. In the Structure Pane, drag and drop a Panel Group Layout into the top facet.

  12. With the panelGroupLayout selected, set the Layout property, in the Property Inspector, to horizontal.

  13. In the Application Navigator, expand the Web Content | images nodes and drag and drop the brandingImage.gif node onto the Panel Group Layout. In the context menu select ADF Faces Image .

  14. From the ADF Faces - Layout, drop a Spacer next to the image.

    Then set the Width property to 100.

  15. From the ADF Faces | Common Components, drop an Output Text under the spacer component.

    In the Value field, select  Expression Builder from the drop-down list .

  16. In the Expression Builder, clear out the existing expression and set the value to #{attrs.title}.
    Then click OK.

  17. In the Component Palette, under the ADF Faces drop-down, expand the Layout node and scroll down to the Core Structure section. Drag and drop a Facet onto the center facet.

    In the Insert Facet Ref dialog, select center as the facet name, then click OK.

  18. Click the Save All  icon in the JDeveloper menu bar, or select File - Save All from the menu to save the page.

Step 2: Designing a Page using the Page Template

Now that the template has been created you can create a new page, and use the template as the default structure for the page. To do this, perform the following steps:

You can use page templates to build JSF pages or page fragments. Read more...
  1. Right-click the adffaces project and select New from the context menu.

  2. In the New Gallery, expand the Web Tier node and select JSF/Facelets. Then select the Page item and click OK.

  3. In the Create JSF Page dialog, leave the file name to the untitled1.jspx default value and ensure the Document Type is set to Facelets. Then select simple from the drop-down list for the Page Layout section.

    Then click OK.

  4. The untitled1.jspx appears as a new node in the Application Navigator and it opens up in the Design editor using the simple.jspx template.

  5. From the component palette, using the ADF Faces | Layout library, drag and drop a Panel Splitter component onto the center facet.

    In addition to the Panel Splitter, ADF Faces provides a number of other layout components that can be used to arrange other components on a page. Read more...

  6. Drag and drop another Panel Splitter component onto the 'second' facet of the panel splitter.

  7. In the Structure pane, expand the first panelSplitter component and select the second one. Using the property inspector, set the Orientation to vertical.

  8. Drag and drop a Panel Accordion component onto the 'first' facet on the left hand side of the panel splitter.

    In the Property Inspector, set the Text to My Cart.

  9. Click within the accordion you just created, then right-click on the showDetailItem and from the context menu select Insert after Show Detail Item - Show Item Detail.

    For the show detail item that you just added, using the Common tab of the Property Inspector, change the Text field to More Info.

  10. Drag and drop a Panel Collection component onto the right hand side 'first' facet.

  11. Drag and drop a Panel Tabbed component onto the right hand side 'second' facet. The component can be found in the Interactive Containers and Headersgrouping.

    In the Structure pane, select the af:showDetailItem component you just created and In the Property Inspector, enter Product Details in the Text field.

  12. Right click the Product Details tab and select Insert After Show Detail Item - Show Detail Item from context.

    In the Structure pane, select the af:showDetailItem component you just created and in the Property Inspector, enter Rating in the Text field.

    The page should look like the following image.

  13. Save all your work. Then right-click in the page and from the context menu, select Run.

  14. The page will load in your browser. Experiment with selecting the tabs and expanding the More Info panel. Once you're finished, keep the browser open and return to JDeveloper

  15. In the next steps, you customize the page title and see how it is consumed in the existing page. To start the process, open the simple.jsf template page you created earlier.

  16. In the page designer, select the title component.

    In the Property Inspector, expand the Style node, and using the Font/Text node, in the Color field click the Color drop-down list and select the color of your choice (Aqua in our example).

    In the Font Size property, and select large from the drop-down list.

  17. Save all your work. Then go back to the browser and reload the page to see the new characteristics.

    Note that after saving your JDeveloper application, refreshing your browser window reflects the new changes made to your application as long as you haven't updated any binding component. In that case you will need to reRun the page from JDeveloper in order to have the changes reflected in your browser.

  18. Open the untitled page in the design editor.

  19. In the Structure pane, select the pageTemplate tag and in the Property Inspector, set the Title property to Store Front.

  20. Save all your work. Then go back to the browser and reload the page to see the new characteristics.

Summary

In this tutorial you developed a page template, created a page based on the template, added data controls to the page, employed partial page rendering, included DVT components and changed the look and feel of the page using a css file. You learned how to:

    • Create a Page Template
    • Design a Page using the Page Template

程序员的基础教程:菜鸟程序员

Developing ADF PageTemplates的更多相关文章

  1. Developing RIA Web Applications with Oracle ADF

      Developing RIA Web Applications with Oracle ADF Purpose This tutorial shows you how to build a ric ...

  2. ADF_Desktop Integration系列4_ADF桌面集成入门之部署ADF Desktop Excel

    2013-05-01 Created By BaoXinjian

  3. ADF_Desktop Integration系列3_ADF桌面集成入门之重定义ADF Desktop Excel

    2013-05-01 Created By BaoXinjian

  4. ADF_Desktop Integration系列2_ADF桌面集成入门之开发简单ADF Desktop Excel

    2013-05-01 Created By BaoXinjian

  5. ADF_Starting系列5_使用ADF开发富Web应用程序之维护User Interface(Part2)

    2014-05-05 Created By BaoXinjian

  6. ADF_Starting系列4_使用ADF开发富Web应用程序之维护User Interface(Part1)

    2014-05-04 Created By BaoXinjian

  7. ADF_Starting系列2_使用ADF开发富Web应用程序之建立Business Services

    2013-05-01 Created By BaoXinjian

  8. Developing User Interfaces

      Developing a User Interface with ADF Faces Purpose This tutorial covers developing the user interf ...

  9. Codeforces Round #222 (Div. 1) D. Developing Game 线段树有效区间合并

    D. Developing Game   Pavel is going to make a game of his dream. However, he knows that he can't mak ...

随机推荐

  1. ie下 iframe在页面中显示白色背景 如何去掉的问题

    ie下:

  2. 学习MongoDB 五: MongoDB查询(数组、内嵌文档)(二)

    一.简介 我们上一篇介绍了db.collection.find()可以实现根据条件查询和指定使用投影运算符返回的字段省略此参数返回匹配文档中的所有字段,我们今天介绍了对数组和内嵌文档的查询操作,尤其是 ...

  3. openx ————带整理

    the initialisation file  初始化文件 Security check        安全检查 /work/puti-api-1.0/www/adapi/lib/OA/Admin/ ...

  4. 我对if(!this.IsPostBack)的理解

    if(!this.IsPostBack) { } 通常用在page_load中,获取一个值,该值指示该页是否正为响应客户端回发而加载,或者它是否正被首次加载和访问,如果是为响应客户端回发而加载该页,则 ...

  5. leetcode237

    /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNo ...

  6. Mysql 索引优化 - 2

    永远小表驱动大表(小数据驱动大数据) in exists区别, SELECT * FROM A WHERE A.id in (SELECT id FORM B) 若A表数据大于B表数据用in SELE ...

  7. Springmvc Exception

    对于异常处理,大多使用一个共同的异常类统一处理从dao,service,controller层抛出的异常,将页面跳转到共同的error页面. public class CommonException ...

  8. Nexus使用

    Nexus使用: Nexus的默认登录账户:admin,密码:admin123. 以下为步骤说明: 1.右上角->login 2.左菜单->security->user->ad ...

  9. 14 MySQL--事务&函数与流程控制

    一.事务 事务用于将某些操作的多个SQL作为原子性操作,一旦有某一个出现错误,即可回滚到原来的状态,从而保证数据库数据完整性. 一堆sql语句:要么同时执行成功,要么同时失败 # 事务的原子性 场景: ...

  10. python 之九九乘法表

    for i in range(1,10): for j in range(1,i+1): print(f"{j}*{i}={i*j}",end='\t') print() 运行结果 ...