What Happens When You Create a Page Template

19-18 Web User Interface Developers Guide for Oracle Application Development Framework f:view jsp:root

19.3.5 What Happens at Runtime: How Page Templates Are Resolved

When a JSF page that consumes a page template is executed: ■ The pageTemplate component in the consuming page, using the viewId attribute for example, af:pageTemplate viewId=sampleTemplateDef1.jspx, locates the page template definition file that contains the template component metadata and layout. ■ The component subtree defined in the layout section of the pageTemplateDef tag is instantiated and inserted into the consuming page’s component tree at the location identified by the pageTemplate tag in the page. ■ The consuming page passes facet contents into the template using the facet tag. The facet contents of each facet tag are inserted into the appropriate location on the template as specified by the corresponding facetRef tag in the layout section of the pageTemplateDef tag. ■ The consuming page passes values into the template by using the attribute tag. The pageTemplateDef tag sets the value of the var attribute so that the pageTemplate tag can internally reference its own parameters. The pageTemplate tag just sets the parameters; the runtime maps those parameters into the attributes defined in the pageTemplateDef tag. ■ Using template component metadata, the pageTemplate tag applies any default values to its attributes and checks for required values. For information about what happens when the page template uses ADF Model data binding, see the Using Page Templates section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework.

19.3.6 What You May Need to Know About Page Templates and Naming Containers

The pageTemplate component acts as a naming container for all content in the template whether it is direct content in the template definition, or fragment content included using the jsp:include action. When working with client-side events in template-based pages, you must include the template’s ID when using code to locate a component. For more details, see Section 5.3.7, What You May Need to Know About Using Naming Containers.

19.4 Using Declarative Components

Declarative components are reusable, composite UI components that are made up of other existing ADF Faces components. Suppose you are reusing the same components consistently in multiple circumstances. Instead of copying and pasting the commonly Note: Page templates are processed during JSP execution, not during JSF processing that is, component tree creation. This means that fragments built from page templates cannot be used within tags that require the component tree creation. For example, you could not include a fragment based on a template within an iterator tag and expect it to be included in a loop.