Registering the Portlet as a WSRP Producer
WSRP defines a set of interfaces that standardize interactions between portlet components and a user application. The portlet components generate markup that the user application consumes. Before consuming a portlet in a WebCenter application page, you must obtain a WSDL and then register a WSRP Producer for the portlet with the application. You can obtain the WSDL URLs from the URL http://localhost:6688/portletsApp/info
, port 6688 being the HTTP port (see Figure 5
|Figure 5. WSRP Producer Test Page:|
You can obtain the WSDL URLs from http://localhost:6688/portletsApp/info, port 6688 being the HTTP port.
The WebCenter Framework provides a WSRP Producer Registration wizard (see Figure 6), which you will use to register a WSRP Producer with the WebCenter application for the JSF portlet. Select the ViewController project and choose File->New. In the New Gallery wizard, select Web Tier->Portlets and then WSRP Producer Registration. Click OK. This will start the WSRP Portlet Producer Registration Wizard. Click Next. Specify a name for the WSRP Producer and click Next again.
Obtain the WSDL URL for the JSF portlet application from the WSRP Producer Test Page, and specify that URL in the URL Endpoint field. Click Next. Leave the execution timeout for the producer as the default value and click Finish. You have now registered the WSRP Portlet Producer with the WebCenter application, as well as added it to the application (see Figure 6).
|Figure 6. WSRP Portlet Producer:|
You have now registered the WSRP Portlet Producer with the WebCenter application.
Adding a Portlet to a JSF Page
Portlets registered with a WebCenter application using a WSRP Portlet Producer become available in the Component palette. In this section, you will add the JSF portlet to a JSF page. Select the ViewController project and select File->New. Select Web Tier->JSF->JSF JSP and click OK. To enable page customizations, create the WebCenter application JSF page as a .jspx document instead of a JSP document. Click Next. In the Component Binding window, select Do Not Automatically Expose UI Components in a Managed Bean and click Next. In the Tag Libraries window, select the ADF Portlet Components library, which is required to add portlets to a JSF page. If you require page customizations, select the Customizable Components Core library. Customizable components are JSF components such as PanelCustomizable and ShowDetailFrame that add additional features such as layout, scrollbar, provision to maximize, minimize to the JSF page, etc. Click Next.
Next, add the JSF portlet that you generated earlier to the JSF page. Position the cursor in the PortletsPage.jspx page, select WsrpPortletProducer1 in the Component Palette, and then choose the DataTable Portlet. The DataTable Portlet gets added to the JSF page just like any other JSF component would.
A portlet on a JSF page is represented with the adfp:portlet tag, in which you can specify additional attributes such as height, width, icon, isMaximizable, isMinimizable, isMovable, inlineStyle, background, and displayScrollBar. Next, run the WebCenter application JSF page by right-clicking PortletsPage.jspx and selecting Run. The JSF DataTable portlet will display (see Figure 7). You can also add multiple portlets to a JSF page.
|Figure 7. JSF Portlet:|
Run the WebCenter application JSF page by right-clicking PortletsPage.jspx and selecting Run.
Next, specify a SQL query statement in the SQL input field, and click the Create Data Table button. A data table will display with the Oracle database as the data source (see Figure 8).
|Figure 8. DataTable Portlet:|
A data table will display with the Oracle database as the data source.
You're done! Your JSF portlet is running in a WebCenter application, using an Oracle database as the data source and relying on a data table.