Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Web Development

.NET Development & the IBM WebSphere Portal Server

Source Code Accompanies This Article. Download It Now.

Shelly has worked in software development for 18 years and is a freelance software consultant. She can be contacted at [email protected].

Business users like web portals because portal views let them work with corporate data and business processes through a single, consistent UI. Software development teams like them because portals provide a comprehensive UI framework and the architectural opportunity to integrate applications in real-time at the front-end, rather than via potentially costly and unreliable offline batch processes at the back-end. Consequently, portals are increasingly considered an essential part of an enterprise SOA strategy. .NET developers, however, have had limited options when it comes to portals, since most high-end portals—BEA's WebLogic Portal Server and IBM's WebSphere Portal Server come to mind—are based on Java EE. In this article, I present techniques and examine tools for developing .NET applications for IBM's WebSphere Portal Server.

JSR 168

The major portlet specification is JSR 168 (jcp.org/ en/jsr/detail?id=168), which ensures that portlets developed in Java can run on multiple portal servers. Many commercial and open-source organizations have adopted this standard, which defines the programming model for portlets and the contract between the portlets and the portlet container.

[Click image to view at full size]

Figure 1: Portlet lifecycle.

The portlet lifecycle (Figure 1) consists of two main phases:

  • The processAction phase lets the portlet respond to events and has two parameters: ActionRequest and ActionResponse. ActionRequest provides access to information such as the request, the window's state, the portlet session, and portlet preferences data. The ActionResponse object is used to change mode or state during the request.
  • The render phase is used by portlets to generate content as HTML fragments. It also has two parameters: RenderRequest and RenderResponse. The RenderRequest object provides access to similar information as the ActionRequest object. The RenderResponse object is used to return content, or delegate content to a JSP or servlet.

The portlets are defined as a standard portlet descriptor file, portlet.xml; see Listing One. Within JSR 168 is consistent support for persistent and transient data management. Portlets can access two different types of persistent data:

  • Initialization Parameters. Read-only data defined in the portlet deployment descriptor file. Examples include the names of the files that make up the portlet.
  • Portlet Preferences. User-dependent data, usually acquired from the portlet in Edit mode, can also be used via the PortletPreferences node of portlet.xml (Listing Two). Portlets can read/write preferences in the processAction phase but can only read in the render phase.

$?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <description>This is a test portlet</description>
    <portlet-name>A test portlet</portlet-name>
    <display-name>A Test Portlet</display-name>
        <title>Test Portlet</title>
Listing One

Listing Two

Transient data comes from two sources:

  • Session data, which is handled just like any web application. To prevent two portlets from using the same Session variable, the name of the portlet is automatically prefixed by the portlet container to each Session variable defined in the portlet.
  • Modes and Window State, where all portlets support View (default), Edit, and Help modes. If the Edit mode is implemented, users can change the portlet configuration. This type of configuration information can be persisted anywhere you choose—in Session or in a datastore. Help mode displays help about using the portlet. A number of custom modes can also be implemented (see JSR 168).

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.