Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Create a JSF Portlet with Oracle WebCenter Suite and JDeveloper : Page 3

A portal provides users with a unified presentation of portlets generated from disparate data sources. Learn how to develop a JSF portlet with JDeveloper and run it in Oracle's WebCenter Framework.


WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

Modifying the web.xml and portlet.xml Deployment Descriptors
Add the following context-param elements to the web.xml file:

<context-param> <param-name>javax.faces.application.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml,/WEB-INF/portlet.xml</param-value> </context-param> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param>

Add the following ADF Faces filter to the web.xml deployment descriptor:

<filter> <filter-name>adfFaces</filter-name> <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class> </filter>

Modify the portlet.xml deployment descriptor as follows:

  • Specify a portlet with the <portlet></portlet> element.
  • Specify a portlet class as oracle.portlet.server.bridges.jsf.FacesPortlet.
  • Specify a <init-param/> element for the default page to be displayed when the portlet is run:

    <init-param> <name>DefaultPage.view</name> <value>/input.jsp</value> </init-param>

  • Specify a <init-parm/> element for the BridgeLifecycleListeners listener class:

    <init-param> <name>BridgeLifecycleListeners</name> <value> oracle.portlet.server.bridges.jsf.adf.ADFFacesBridgeLifecycleListener </value> </init-param>

Listing 3 shows the resulting portlet.xml deployment descriptor.

Establishing a JDBC Connection with the Database
To configure a JDBC connection with your Oracle database, select the Connections view, right-click the Database node, and select New Database Connection. Specify OracleDBConnection as the connection name, select Oracle JDBC as the connection type, and click Next. Specify OE as the username and password and click Next. Select the default settings for the connection URL and click Next again. Test the connection with Test Connection and click Finish.

Add a <resource-ref/> element for the JDBC data source to web.xml:

<resource-ref> <res-ref-name>jdbc/OracleDBConnectionDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>

The complete web.xml deployment descriptor is listed in Listing 4.

Deploying the JSF Portlet
Now you will deploy the JSF portlet to the OC4J that is pre-configured with the WebCenter Framework. First, create a deployment profile for the JSF portlet application:

  1. Select the Portlets project in the Applications Navigator and select File->New.
  2. In the New Gallery wizard, select General->Deployment Profiles->WAR File and click OK.
  3. Specify “webapp1” as the deployment profile name and click OK.
  4. Specify “portletsApp” as the J2EE Web Context Root in the WAR Deployment Profile Properties Frame, and click OK.
  5. Select Tools->Start WebCenter Preconfigured OC4J, and click Yes in the Install WebCenter Preconfigured OC4J dialog, to install and start the WebCenter preconfigured OC4J (see Figure 3).

    Click to enlarge

    Figure 3. Starting the WebCenter Preconfigured OC4J:
    Install and start the WebCenter preconfigured OC4J.

The following message indicates that the WebCenter Preconfigured OC4J has been started:

Oracle Containers for J2EE 10g ( initialized

Next, configure a connection with the WebCenter Preconfigured OC4J. In the Connections view, right-click Application Server and select New Application Server Connection. Click Next in the Create Application Server Connection Wizard, specify LocalOC4J as the connection name, and select Standalone OC4J 10g 10.1.3 as the connection type. Click Next. Leave "oc4jadmin" (the default) as the username and specify "welcome" as the password. Click Next. Leave "localhost" (the default) as the host name and specify the RMI Port as 22667. Click Next.

Click Test Connection and then click Finish to test the connection. With that, you have created a connection to the WebCenter Preconfigured OC4J (see Figure 4).

Click to enlarge

Figure 4. Web Center Preconfigured OC4J Connection:
You have created a connection with the WebCenter Preconfigured OC4J.

Next, deploy the WAR deployment profile that you created from the JSP portlet application to the WebCenter Preconfigured OC4J. Right-click webapp1.deploy and select Deploy to->LocalOC4J. Click OK in the Configure Application Window to create the WSDLs for the WSRP application and to deploy the JSF portlet application to the WebCenter Preconfigured OC4J.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date