Feeds

Creating a Portlet from a JSF Application with WebCenter

Pass the portlet, dear

7 Elements of Radically Simple OS Migration

A portal is a web application that aggregates a collection of web applications (portlets) running on a page in separate windows. A portlet is a web component (application) that runs in a portlet container, processes requests and generates dynamic content.

Portlets are the pluggable user interface components in a portal page. Portlets facilitate the development of SOA (Service Oriented Architecture) based applications. The different portlets in a portal page may obtain data from different data sources. Java Portlet Specification (JPS), based on Java Specification Request (JSR 168), and Web Services for Remote Portlets (WSRP) are standards for developing and consuming portlets.

Oracle WebCenter Suite is the newest component of the Oracle Fusion Middleware. Oracle WebCenter Suite, based on SOA, provides a unified environment in which a user may access different enterprise applications and services. JDeveloper 10.1.3.2 includes a WebCenter Framework pre-configured OC4J using the WebCenter extension for JDeveloper. The WebCenter pre-configured OC4J provides a JSR 168 portlet container for developing WSRP 1.0/WSRP 2.0 standards based portlets. Portlet applications may be developed in JDeveloper and deployed to the WebCenter Framework. Subsequently, the portlet may be consumed in a WebCenter application by registering a WSRP producer with the application. In this article we shall develop an example JSF portlet based on the JSR 168 and WSRP 2.0 standards and run the portlet in the WebCenter Framework.

Setting the Environment

Install JDeveloper 10.1.3.2 Studio Edition. We shall create a JSF DataTable based portlet. We shall use the Oracle database as the datasource for the JSF portlet. Install Oracle 10g database including the Oracle database instance ORCL and the sample schemas. Create an example database table CATALOG in the OE schema from SQL *Plus with SQL script catalog.sql, in the Resources zip file.

Creating a JSF Portlet

The example JSF application that is to be portelized consists of a DataTable that is generated dynamically using an SQL query. First, create a JDeveloper application with WebCenter Application as the application template. The WebCenter application consists of the Portlets project for creating portlets and the ViewController project for creating JSF view pages in which portlets may be embedded. Add the library for the JSF-Portlet Bridge to the Portlets project.

Adding Portlet Libraries.

Next, create a JSF application to be portelized and deployed in the WebCenter Framework enabled OC4J with File>New>Web Tier>JSF. Select Automatically Expose UI Components in a new Managed Bean, specify a class name (PortletBean). Add portlet.xml to the Portlets project with File>New>General>Deployment Descriptors>portlet.xml. In the Component Palette select JSF HTML and add a Output Label, an Input Text, a Command Button and a Data Table to the JSF page input.jsp.

Adding JSF Components.

The JSF portlets application files are available in the in the Resources zip file. Next, configure a JDBC connection with the Oracle database. Select the Connections view, right-click on the Database node and select New Database Connection. Next, create a deployment profile, webapp1, for the JSF portlet application with a J2EE Web Context Root of portletsApp.

Deploying the JSF Portlet

Next, deploy the JSF portlet to the OC4J that is pre-configured with the WebCenter Framework. Start the WebCenter Preconfigured OC4J with Tools>Start WebCenter Preconfigured OC4J. Configure a connection with the WebCenter Preconfigured OC4J. In the Create Application Server Connection Wizard specify connection name (LocalOC4J), connection type as Standalone OC4J 10g 10.1.3, username as oc4jadmin, password as welcome, host name as localhost, and RMI Port as 22667. Next, deploy the WAR deployment profile that was created from the JSP portlet application to the WebCenter Preconfigured OC4J. Right-click on webapp1.deploy and select Deploy to>LocalOC4J. The WSDLs for the WSRP application get created.

Registering a Portlet as a WSRP Producer

WSRP defines a set of interfaces that standardize interactions with portlet components that generate markup to be consumed in a user application. Before consuming a portlet in a WebCenter application page, a WSRP Producer for the portlet is required to be registered with the application. The WebCenter Framework provides a WSRP Producer Registration wizard to register a WSRP 1.0/WSRP 2.0 Producer for a portlet with an application. A WSDL is required to register WSRP Producer with an application. The WSDL URLs may be obtained from URL http://localhost:6688/portletsApp/info, port 6688 being the HTTP port.

WSRP Producer Test Page.

Next, register a WSRP Producer for the JSF portlet with the WebCenter application. Select the ViewController project and select File>New. In the New Gallery wizard select Web Tier>Portlets. Select WSRP Producer Registration and click on OK. In the WSRP Portlet Producer Registration Wizard specify a name for the WSRP Producer and click on Next. Obtain the WSDL URL for the JSF portlet application from the WSRP Producer Test Page and specify the URL in the URL Endpoint field.

Specifying Portlet URL

Specify the default execution timeout fro the producer and click on Finish. The WSRP Portlet Producer gets registered with the WebCenter application.

Portlet Application Directory Structure.

Adding a Portlet to a JSF Page

Portlets registered with a WebCenter application using a WSRP Portlet Producer become available in the Component palette just like any other JSF component. In this section the JSF portlet is added to a JSF page. Add a .jspx JSF page to the ViewController project. In the Tag Libraries window select the ADF Portlet Components library, which is required to add portlets to a JSF page. Next, add the JSF portlet that was generated earlier to the JSF page. Position the cursor in the PortletsPage.jspx page and select WsrpPortletProducer1 in the Component Palette and select the DataTable Portlet. The DataTable Portlet gets added to the JSF page just like any other JSF component would. Run the WebCenter application JSF page.

Running a WebCenter Application JSF Page.

The JSF DataTable portlet gets displayed. Specify a SQL query statement in the SQL input field and click on the Create Data Table button – see Figure 7.

Specifying an SQL Query.

Finally, a Data Table gets displayed; with the Oracle database as the datasource for the Data Table – see Figure 8.®

DataTable Portlet.

Endpoint data privacy in the cloud is easier than you think

More from The Register

next story
PEAK LANDFILL: Why tablet gloom is good news for Windows users
Sinofsky's hybrid strategy looks dafter than ever
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Fiendishly complex password app extension ships for iOS 8
Just slip it in, won't hurt a bit, 1Password makers urge devs
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cloudy CoreOS Linux distro declares itself production-ready
Lightweight, container-happy Linux gets first Stable release
prev story

Whitepapers

7 Elements of Radically Simple OS Migration
Avoid the typical headaches of OS migration during your next project by learning about 7 elements of radically simple OS migration.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Solving today's distributed Big Data backup challenges
Enable IT efficiency and allow a firm to access and reuse corporate information for competitive advantage, ultimately changing business outcomes.
A new approach to endpoint data protection
What is the best way to ensure comprehensive visibility, management, and control of information on both company-owned and employee-owned devices?