Feeds

Creating a Portlet from a JSF Application with WebCenter

Pass the portlet, dear

Combat fraud and increase customer satisfaction

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.

SANS - Survey on application security programs

More from The Register

next story
Next Windows obsolescence panic is 450 days from … NOW!
The clock is ticking louder for Windows Server 2003 R2 users
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Ditch the sync, paddle in the Streem: Upstart offers syncless sharing
Upload, delete and carry on sharing afterwards?
Microsoft TIER SMEAR changes app prices whether devs ask or not
Some go up, some go down, Redmond goes silent
Batten down the hatches, Ubuntu 14.04 LTS due in TWO DAYS
Admins dab straining server brows in advance of Trusty Tahr's long-term support landing
Red Hat to ship RHEL 7 release candidate with a taste of container tech
Grab 'near-final' version of next Enterprise Linux next week
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Inside the Hekaton: SQL Server 2014's database engine deconstructed
Nadella's database sqares the circle of cheap memory vs speed
prev story

Whitepapers

Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Top three mobile application threats
Learn about three of the top mobile application security threats facing businesses today and recommendations on how to mitigate the risk.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.