How to Create JSF JSP Pages

2-10 Web User Interface Developers Guide for Oracle Application Development Framework

2. Complete the Create JSF Page dialog. For help, click Help in the dialog. For more

information about the Page Implementation option, which can be used to automatically create a backing bean and associated bindings, see Section 2.4.3, What You May Need to Know About Automatic Component Binding.

2.4.2 What Happens When You Create a JSF JSP Page

When you use the Create JSF Page dialog to create a JSF page, JDeveloper creates the physical file and adds the code necessary to import the component libraries and display a page. The code created depends on whether or not you chose to create a .jspx document. Example 2–3 shows a .jspx page when it is first created by JDeveloper. Example 2–3 Declarative Page Source Created by JDeveloper ?xml version=1.0 encoding=UTF-8? jsp:root xmlns:jsp=http:java.sun.comJSPPage version=2.1 xmlns:f=http:java.sun.comjsfcore xmlns:h=http:java.sun.comjsfhtml xmlns:af=http:xmlns.oracle.comadffacesrich jsp:directive.page contentType=texthtml;charset=UTF-8 f:view af:document id=d1 af:form id=f1af:form af:document f:view jsp:root If you chose to use one of the quick layouts, then JDeveloper also adds the components necessary to display the layout. Example 2–4 shows the generated code when you choose a two-column layout, where the first column is locked and the second column stretches to fill up available browser space, and you also choose to apply themes. Example 2–4 Two-Column Layout ?xml version=1.0 encoding=UTF-8? jsp:root xmlns:jsp=http:java.sun.comJSPPage version=2.1 xmlns:f=http:java.sun.comjsfcore xmlns:h=http:java.sun.comjsfhtml xmlns:af=http:xmlns.oracle.comadffacesrich jsp:directive.page contentType=texthtml;charset=UTF-8 f:view af:document id=d1 af:form id=f1 af:panelStretchLayout startWidth=100px id=psl1 f:facet name=start f:facet name=center -- id=af_twocol_left_sidebar_stretched -- af:decorativeBox theme=dark id=db2 f:facet name=center af:decorativeBox theme=medium id=db1 f:facet name=center af:decorativeBox f:facet af:decorativeBox f:facet af:panelStretchLayout af:form Getting Started with ADF Faces 2-11 af:document f:view jsp:root If you chose to automatically create a backing bean using the Page Implementation section of the dialog, JDeveloper also creates and registers a backing bean for the page, and binds any existing components to the bean. Example 2–5 shows the code created for a backing bean for a page. Example 2–5 Declarative Backing Bean Source Created by JDeveloper package view.backing; import oracle.adf.view.rich.component.rich.RichDocument; import oracle.adf.view.rich.component.rich.RichForm; public class MyFile { private RichForm f1; private RichDocument d1; public void setF1RichForm f1 { this.f1 = f1; } public RichForm getF1 { return f1; } public void setD1RichDocument d1 { this.document1 = d1; } public RichDocument getD1 { return d1; } } Additionally, JDeveloper adds the following libraries to the view project: ■ ADF Faces Runtime 11 ■ ADF Common Runtime ■ ADF DVT Faces Runtime ■ Oracle JEWT ■ ADF DVT Faces Databinding Runtime JDeveloper also adds entries to the web.xml file, as shown in Example 2–6 . Example 2–6 Code in the web.xml File After a JSF JSP Page is Created ?xml version = 1.0 encoding = UTF-8? web-app xmlns:xsi=http:www.w3.org2001XMLSchema-instance xsi:schemaLocation=http:java.sun.comxmlnsjavaee http:java.sun.comxmlnsjavaeeweb-app_2_5.xsd Tip: You can access the backing bean source from the JSF page by right-clicking the page in the editor, and choosing Go to and then selecting the bean from the list.