Search This Blog


Wednesday, April 20, 2011

ADF: About JSF fragments, ADF regions, declarative components …

Starting application development with Oracle ADF and ADF Faces, some concepts may be hard to grasp at the beginning. Using Oracle ADF and ADF Faces, the following terminologies are used in the context of reuse of components and processes
JSF fragments
JSF page fragments are page definitions that run embedded in another JSF page. Fragments are like page includes in JavaServer Pages, with the difference that in Oracle ADF Faces they are usually used in the context of ADF regions or dynamic declarative components. You can also reference page fragments directly from a JSP includes tag added to a JavaServer Faces document (JSPX). However, in this case, and only if a page fragment has ADF bound content, you need to make sure the content of the page fragments ADF binding file (PageDef) is copied to the PageDef file of the parent page. Otherwise ADF queried data will not show.
ADF regions
ADF regions consist of an ADF Faces af:region tag, an ADF bounded task flow and page fragments. Page fragments that are used in a bounded task flow don't need to copy their ADF binding references to the parent container, which is a huge difference between JSP includes and ADF regions. ADF regions define an interactive area on a view, a JSF document or another JSF page fragment, that developers use to show a single view or a complete, multi-step, process. ADF regions can be statically or dynamically defined. In either way they require a PageDef file and a bounded task flow to reference. ADF regions help building desktop like web applications in which users stay for long on a single page while working on a business task.
Declarative components
Declarative components allow developers to build a composite component out of existing ADF Faces components. Declarative components exist in two flavors: library driven and dynamic declarative components (ddc). The tag library driven components are declaratively built from the File | New menu option. In the JSF view option you find a declarative component menu option that steps you through building your own ADF F aces component from existing ADF Faces components. You use tag library driven declarative components to build custom components with behavior, like a tool bar or a custom file-upload handler. The goal of building declarative components is to build re-usable components that simplify development and administration by avoiding duplicate page codes. Dynamic declarative components (DDC) are used within the scope of the web application they are defined in and cannot be re-used across applications. Their main usage is to build reusable layout artifacts or page area components. For example, a custom tab canvas is what you would build using DDC components.  
Page templates
Page templates are layout definitions that you use as a starter when building new pages to enforce consistent page layouts throughout applications and enterprises. Best practices are to build a page template using the ADF Faces Quick start templates. You cannot nest page templates, but you can use page templates on parent and child views (page fragments). A page template is the page level equivalent to a DDC component.
ADF Library
ADF libraries are special Oracle ADF archive files that you use to reuse bounded task flows (regions), page templates and declarative components. They are standard JAR files with extra information in the archive manifest file that allows you to import the library files into the Oracle JDeveloper Resource Palette for declarative reuse.
When designing an application you best start planning reuse of components and page segments. If you have an application wide look and feel that you can define as page template(s) then do this first. If you can identify areas within pages that you may need more often on other pages as well, without the pages to be identical from their layout, you use dynamic declarative components. For functionality like global toolbars or common and composite user interface logic, you build tag library based declarative components, which then can be used across applications too. An ADF region is an interactive and optionally also data centric page are that you use to show complete business processes in place. ADF regions are a friend for building rich Internet application interfaces and business centric web desktops. ADF libraries are the vehicle to deploy your reusable work.
Read more:
Fragments, Templates, Declarative Components