Portletize a JSF Application Using Oracle JSF Portlet Bridge

Enable JSF Navigation : Drag and drop JSF Page objects. Add an ADF Button to Page1 and ADF Link to Page2, and then enable navigation between the two pages.

Portletize the JSF Page : Using the Oracle JSF Portlet Bridge, create a portlet entry from one of the pages.

Deploy the JSF Application : Deploy and test the JSF application using Integrated WLS Server. It generates a WSRP v2 URL for the deployed application, which is used to register the WSRP portlet producer.

Create a WebCenter Application : Use the WebCenter Application template to create a WebCenter application.

Register the JSF Application as a WSRP Portlet Producer : Register the WSRP v2 URL that was generated during deployment and testing of the JSF application.

Add the JSF Portlet to a Page : Add the JSF portlet by dragging and dropping it onto the page. After that, you can run the page to see the portlet in action.

 

Create a JSF Application

tell me more icon Creating a JSF Application

To begin creating a new JSF application, open the Create Application dialog by clicking New Application in the Application Navigator.   [ tell me more...]





  1. Open the Create Application dialog [ File > New > Application.
  2. On Step 1, in the Application Name field, enter SimpleApplication, to follow along with the example.
  3. In the Directory field, specify a directory.
  4. From the Application Template list, select Fusion Web Application (ADF).

    tell me more icon Application Templates

    Application templates provide a quick way to create the project structure for standard applications with the appropriate combination of technologies already specified. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated technology scopes set. The application template you select determines the initial project structure (the named project folders within the application) and the application libraries that will be added. The project templates define the associated technologies.   [ tell me more...]



  5. On Steps 2 through 4, click Next on these pages to accept the default values.
  6. On Step 5, click Finish .

    tell me more icon In the IDE

    The application template partitions your application into two projects: Model and ViewController. In the Application Navigator, projects display at the top level in the hierarchy. The Application Navigator should look like this:  [ tell me more...]



 

Enable JSF Navigation

tell me more icon Enabling JSF Navigation

Navigation is enabled between two pages based on the results of certain logical conditions that are executed in a page. For example, if you enter correct credentials in a login page, then the index page displays; otherwise, an error message indicates incorrect user name and password. In this step, you enable navigation between two pages through an ADF Faces button and an ADF Faces link. You can model the navigation cases in the Diagram tab of the faces-config.xml file.  [ tell me more...]





  1. In the Application Navigator, expand ViewController, Web Content, and WEB-INF.
  2. Double-click the faces-config.xml file to open the Diagram tab.
  3. From the Component Palette, select JSF Diagram Objects.
  4. From Components, drag the Component Palette > JSF Diagram Objects > Components > JSF Page JSF Page element and drop it in the Diagram tab of faces-config.xml.
  5. In the Diagram tab, double-click the element to display the Create JSF Page dialog.
  6. In the File Name field, enter orderPage1, then select Create as XML Document (*.jspx), and then click OK.
  7. Click the faces-config.xml tab to show the Diagram tab.
  8. Drag another JSF Page element and create a JSF page named orderPage2.
  9. Click the faces-config.xml tab to show the Diagram tab.
  10. In the Component Palette, click Component Palette > JSF Diagram Objects > Components > JSF Navigation Case JSF Navigation Case . Then click the orderPage1 diagram and then the orderPage2 diagram. Enter goNext for the outcome label.
  11. In the Component Palette, click Component Palette > JSF Diagram Objects > Components > JSF Navigation Case JSF Navigation Case again. Then click the orderPage2 diagram and then the orderPage1 diagram. Enter goBack for the outcome label.

    tell me more icon Navigating between orderPage1 and orderPage2

    To enable navigation between the JSF pages that were added to the faces-config.xml file, select JSF Navigation Case from the Component Palette.  [ tell me more...]



  12. Go to the Design view of orderPage1.jspx.
  13. From the Component Palette, select ADF Faces.
  14. From ADF Faces, select Component Palette > ADF Faces > Common Components > Button Button and drop it onto the page.
  15. In the Property Inspector - Common tab, under Button Action, from the Action field, select goNext.
  16. Go to the Design view of orderPage2.jspx.
  17. From the Component Palette, select ADF Faces.
  18. From ADF Faces, select Component Palette > ADF Faces > Common Components > Link Link and drop it onto the page.
  19. In the Property Inspector - Common tab, under Link Action, select goBack.
  20. Click File > Save All Save All to save your work.

    tell me more icon In the IDE

    After you enable navigation between orderPage1 and orderPage2, you can use the navigation outcome as the action for a button or a link.   [ tell me more...]



 

Portletize the JSF Page

tell me more icon Portletizing the JSF Application

Oracle JSF Portlet Bridge lets you quickly expose existing JSF applications or task flows as JSR 168 portlets, enabling them to be run remotely. (Portlets must be remote.) When you portletize your JSF application, the application views and your portlet views become one and the same. Thus, you need only maintain one source for both your application and your portlets. Portletizing your JSF application and task flows also eliminates the need to store, maintain, and deploy your portlets separately from your application.   [ tell me more...]





  1. In the Application Navigator, right-click orderPage1.jspx and select Create Portlet Entry.
  2. In the Create Portlet Entry dialog, click OK. The portlet.xml file is created in the Application Navigator, if it does not exist already.

    tell me more icon In the IDE

    When you create a portlet entry from your page, the file portlet.xml is created in the Application Navigator. The Source view for this file looks like this:  [ tell me more...]



 

Deploy the JSF Application

tell me more icon Deploying the JSF Application

To quickly test your application, you can deploy it to the Default Server (Integrated WLS Server) that comes packaged as part of the WebCenter extension. Before you deploy your application to the Default Server, you must start the server by selecting Start Server Instance (IntegratedWebLogicServer) from the Run menu.  [ tell me more...]





  1. In the Application Navigator, select ViewController and open Create Deployment Profile -- WAR File dialog. [ File > New > Deployment Profiles > WAR
  2. In the Deployment Profile Name field, enter SimpleApplication, to follow along with the example and click OK.
  3. In the WAR Deployment Profile Properties dialog, select Specify Java EE Web Context Root.
  4. Enter SimpleApplication and click OK.
  5. In the Project Properties dialog, click OK.
  6. From the Run menu, select Start Server Instance (IntegratedWebLogicServer) to start the Default Server.
  7. Right-click the ViewController project, select Deploy, and then Simple Application.
  8. In the Deploy SimpleApplication dialog, under Deployment Action, select Deploy to Application Server, and click Next .
  9. Under Select Server, select IntegratedWebLogicServer and click Finish .
  10. In the Select Deployment type dialog, click OK.

    tell me more icon Deployment - Log

    You can monitor the status of the deployment in the Deployment - Log. When the project is sucessfully deployed, the log will show Deployment finished message.  [ tell me more...]



  11. To get the WSDL, open the browser and enter the URL in the following format: http:// host: port/ context-root /info. That is, http://localhost:7101/SimpleApplication/info.
    The test page contains a WSRP v2 WSDL link that you will register later as a WSRP portlet. For example, http://localhost:7101/SimpleApplication/portlets/wsrp2?WSDL.

    tell me more icon In the IDE

    Oracle WebCenter supports Web Services for Remote Portlets (WSRP) versions 1.0 and 2.0. In the WebCenter Preconfigured Server Readme page, you will find sample preconfigured portlets for both versions. In this example, you will use the WSRP v2 WSDL link. WSRP 2.0 support is for a preliminary (that is, pre-production) version of WSRP 2.0. This standard provides support for inter-portlet communication and export or import of portlet customizations.   [ tell me more...]



 

Create a WebCenter Application

tell me more icon Creating a WebCenter Application

To begin creating a new WebCenter application, open the Create Application dialog by clicking New Application in the Application Navigator.   [ tell me more...]





  1. Open the Create Application dialog [ File > New > Application.
  2. On Step 1, in the Application Name field, enter MyWebCenterApp, to follow along with the example.
  3. In the Directory field, specify a directory.
  4. Leave the Application Package Prefix field blank. Optionally, you can enter a prefix to use for packages created within this application.
  5. From the Application Template list, select WebCenter Application.

    tell me more icon WebCenter Application Template

    The WebCenter Application template contains the necessary technology scope for including Oracle WebCenter features in your application, such as Oracle Composer, the Resource Palette, task flows, content integration, and WebCenter Services. The WebCenter Application template also divides the application into two projects:   [ tell me more...]



  6. On Steps 2 through 4, click Next on these pages to accept the default values.
  7. On Step 5, click Finish .

    tell me more icon In the IDE

    When you create you application and projects using the WebCenter Application template, the Application Navigator should look like this:   [ tell me more...]



 

Register the JSF Application as a WSRP Portlet Producer

tell me more icon Registering a WSRP Portlet Producer

To register a WSRP portlet producer with your application, you need to provide enough information for the application to contact the producer and access its portlets. WSRP producer registration information can include connection details, including proxy information if required, timeout period and timeout message, session support information, producer name, security role mapping, and the like.  [ tell me more...]





  1. In the Application Navigator, under the MyWebCenterApp application, select the ViewController project, and launch the Register WSRP Portlet Producer wizard [ New > Web Tier > Portlets > WSRP Producer Registration] .
  2. On step 1, in the Producer Registration Name field, enter a name for portlet producer registration, for example JSF2WSRPProducer, then click Next.
  3. On step 2, in the WSDL URL field, enter the URL of the portlet producer, for example, http://localhost:7101/SimpleApplication/portlets/wsrp2?WSDL, then click Next.
  4. On step 3 to 5, accept the default values and click Finish.

    tell me more icon In the IDE

    When the registration is successful, the newly registered producer, which is the portletized JSF application you created in one of the previous steps, displays in JDeveloper under the Application Resources panel. You can select the SimpleApplication_orderPage1_jspx and drag it onto your JSF page.  [ tell me more...]



 

Add the JSF Portlet to a Page

tell me more icon Adding a JSF Portlet to a Page

In this cue card, you will add the SimpleApplication_orderPage1_jspx JSF portlet that you created from the SimpleApplication, to a JSF page in your WebCenter application.  [ tell me more...]





  1. In the Application Navigator under the MyWebCenterApp application, select the ViewController project and launch the Create JSF Page dialog [ File > New > JSF > JSF Page]  to create a JSF page.
  2. In the File Name field, enter a name for your JSF page, for example myPage.
  3. Select Create as XML Document (*.jspx) and click OK.
  4. Under Application Resources, expand WSRP Producer, then expand JSF2WSRPProducer.
  5. Drag the SimpleApplication_orderPage1_jspx portlet onto the page.
  6. Click File > Save All Save All to save your work.
  7. Right-click myPage.jspx and select Run to see the page with the orderPage1 portlet in a browser.

    tell me more icon In the IDE

    When you add the orderPage1 JSF portlet to your page, the Design view should look like this:  [ tell me more...]



 



Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,