Subscribe to WebSphere: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get WebSphere: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

IBM WebSphere software products Authors: Pat Romanski, Liz McMillan, Yeshim Deniz, hyper filter, Timothée Bensimon

Related Topics: Java EE Journal

J2EE Journal: Article

Portal Toolkit for WebSphere Portal

Portal Toolkit for WebSphere Portal

On April 9, 2002, IBM announced WebSphere Portal for Multiplatforms version 4.1, a robust third-generation product that enables customers to build high-performance portal-based solutions. There are a myriad of new features in the new portal offering:

  • J2EE compliance
  • Improved API: Portlets are now further specializations of servlets
  • Improved portlet-rendering performance: Includes parallel rendering of portlets
  • Improved security model: Includes improvements in single sign-on functions and password vaulting
  • New toolkit for portlet development

WebSphere Portal for Multiplatforms Packages
Three packaged versions of the portal are available. The base package, WebSphere Portal Enable, features WebSphere Portal, WebSphere Personalization, Web Content Publisher, and WebSphere Studio Application Developer (WSAD).

WebSphere Portal Extend, the mid-level package, includes all the features of the Enable package plus the basic suite of Lotus collaboration tools. These advanced Lotus tools include instant messaging and access to team rooms; Lotus Collaborative Places, which adds place awareness to any portlet; team collaborations; and shared team documents. Also included is Lotus Domino Extended Search, a tool for searching across extended data stores, including relational databases, Domino databases, and World Wide Web search engines. The Extend package also includes Site Analyzer, a tool for monitoring the performance of the portal server.

The premier portal package, WebSphere Portal Experience, gives enterprises the most complete set of tools available to build a high-performance portal solution. This package includes all the features of the Enable and Extend packages and adds the IBM Tivoli Access Manager, IBM Content Manager, and IBM Enterprise Information Portal. These tools give the enterprise industrial-strength content and data-management tools integrated with the portal.

WebSphere Studio Application Developer
Each package includes a license for WSAD, which integrates several Web application development roles into one tool that provides best-of-breed, integrated development support for:

  • Building J2EE applications with HTML pages, servlets, JavaServer Page (JSP) files, and Enterprise JavaBean (EJB) components
  • Creating Web applications based on Web services open standards
  • Creating and modifying XML documents from DTDs and XML schemas
  • Visual WYSIWYG creation of HTML content documents and JSPs
  • Enabling a collaborative team environment for development of applications
  • Tools for optimizing application performance
  • Enabling end-to-end local and remote application testing
  • Increasing productivity and creating high-quality applications using wizards, code generators, and best practices

Eclipse: A Platform for Tools Development

WSAD is built on the Eclipse platform, an open-source framework for the development of tools for an interactive development environment (IDE). The Eclipse platform supports:

  • Construction of a variety of tools for application development
  • Integration of tools from multiple tool providers, including indepen- dent software vendors
  • Tools to manipulate arbitrary content types (e.g., HTML, Java, C, JSP, EJB, XML, and GIF)
  • Seamless integration of tools within and across different content types and tools providers
  • Both GUI- and non-GUI-based application development environments
  • A wide range of operating systems, including Microsoft Windows and Linux
In addition, the Eclipse platform capitalizes on the popularity of the Java programming language for writing tools. Its principal role is to provide tool providers with mechanisms to use and rules to follow that lead to seamlessly integrated tools. These mechanisms are exposed via well-defined API interfaces, classes, and methods.

The Eclipse workbench (see Figure 1) features a project-based paradigm. As a project is developed, project components are created and modified using tools built into the platform as plug-ins.

When you open or create an Eclipse project, the appropriate set of tools and viewers is opened in the workbench. This placement and view of the tools is called a development perspective. For example, WSAD includes perspectives for Web development, J2EE application development, and generic Java development. When you open help in the workbench, the help perspective is opened. You can change the current perspective at any time.

Introducing the Portal Toolkit
The Portal Toolkit included with all versions of WebSphere Portal is a set of extensions that adds a palette of portlet development tools to WSAD. These tools integrate seamlessly with WSAD and enable rapid development of WebSphere Portal portlet applications written in Java. (A portlet application is a set of portlets packaged together in a Web Archive, or WAR, file.)

Portlet Application Base Project
The portlet application base project extends the J2EE Web application project and packaging mechanism for portlet applications. The base project includes a base Web application descriptor document, web.xml, and a portlet application descriptor document, portlet.xml. A portlet application is packaged in a WAR file with these documents in the WEB-INF directory of the application's WAR file. As portlets are added to a project, the names of the portlets and other settings are automatically added to both the Web application descriptor and the portlet application descriptor.

Portlet and Web Application Descriptor Wizards
The base project also includes creation and management wizards for both the portlet application descriptor and the Web application descriptor. Manual development and maintenance of these descriptor documents is a complex task - values and settings in the Web application descriptor are referenced in the portlet application descriptor and must be kept in sync. The wizards make the management of these descriptor documents an easy task. As values in the Web application descriptor are changed, they're automatically updated in the portlet application descriptor. Users can also update and tweak the values in these documents in an XML editor view, with the new values reflected in the wizards.

Portlet Application Creation Wizard
The portlet application creation wizard empowers the user to create complete portlet application drafts. A draft version of a portlet application is ready for the addition of business logic. Simply answer a few questions in the wizard and specify pertinent portlet options. The wizard then generates a complete portlet application draft based on one of the available portlet helper classes: PortletAdapter, MVCPortlet, JSPPortlet, ServletIn-vokerPortlet, or XSLPortlet. You add business logic and other enhancements to the draft, completing the final portlet application right in the tool. It's now ready for debugging or deployment to a portal server.

Portlet Application Samples
Several portlet application samples are included in the toolkit. These samples are complete portlet applications that demonstrate a particular function. For example, the Yourco White Pages portlet application demonstrates the use and access of a database within a portlet.

One-Step Portlet Debugger
Perhaps the most powerful feature of the Portal Toolkit is the portlet debugger. The debugger supports one-step debugging. When you select the "Run On Server" function on a portlet application, in a single step the application is automatically exported and installed on a target portal server. The portlets in the portlet application are then added to a portal debug page. Finally, a browser is opened and a URL is sent to the browser to log the user into the portal and display the debug page for the user. In previous versions of the portal, testing a portlet was a manual process with a dozen steps - now you can debug a portlet application with a single mouse click.

The portlet debugger has a very robust set of features. Breakpoints can be set anywhere in a portlet application's Java code, or in a JSP. When a breakpoint is reached, the debugger stops and shows the breakpoint in a source view of the portlet. Values in variables and objects may be displayed.

Server Configuration
Server configuration allows the user to create a remote portal server configuration. This configuration is used to determine the target portal server and associated portal parameters used for debugging.

Developing Portlets with the Portal Toolkit
Developing portlet applications is easy. Using the project wizards, samples, and debugger you can build a custom portlet application in minutes, not hours.

Basic development of a portlet application involves four phases: creating the portlet application draft, adding custom logic and views to the application, debugging the application, and deploying it to a production portal server.

We'll walk through these phases of development and show you how to develop a Favorites portlet. The Favorites portlet saves and displays a list of the user's favorite URLs.

Creating a Draft Version of a Portlet Application
The first step in development is to create an initial version of a portlet application. The Favorites portlet will be based on a subclass of the portal's PortletAdapter helper class. Portlets that subclass the PortletAdapter class can support all four portlet display modes. The draft application includes sample JSPs for each display mode.

To create the portlet application draft, click on File | New | Portlet Application Development. A dialog is presented that allows you to enter the name of the portlet application, in this case,"Favorites." The project name and portlet application root directory are known as the context root in the WSAD workspace. On page two of the wizard the type of portlet is selected.

On the final page of the wizard, the portlet application name and the portlet name are selected (see Figure 2). The display markups the portlet is required to support are also specified.

When the finish button is pressed, a complete portlet application skeleton is generated. This skeleton application includes the portlet and Web descriptor documents, the portlet Java class, initial display JSPs for each markup, and the associated JavaBeans passed to the display JSPs.

Adding the Business Logic to the Portlet
Once the initial portlet application has been generated, add the business logic to the portlets in the portlet application. Business logic is typically added in the base portlet Java classes. As you make changes to the Java source statements and save the files, the portlet development environment automatically compiles the application and displays any errors in the Tasks window (see Figure 3).

The portlet development environment also provides source editors for JSPs that are part of the portlet application. In the generated Favorites application, both the HTML and WML markups were specified as being supported by the application. Sample JSPs for each of these markups, for all the portlet display modes, are created as part of the portlet application. The initial generated JSPs contain no custom user interface markup, but using the JSP editor it's simple to add custom markup to these pages.

Debugging the Favorites Portlet Application
Once the business logic and all other code development have been completed, the portlet application is ready for debugging. Invoking the portlet debugger is a simple matter of selecting the portlet project and selecting "Run on Server." The portlet application is dynamically deployed to the portal server, installed, and activated. The portlets in the portlet application are then added to a debug page and a Web browser is opened, displaying the portal debug page with the portlets.

The debug perspective is opened in the workbench. In the debugger, breakpoints may be set in Java code or JSPs. Objects and variables may inspected for particular values. The debugger provides all the features required to debug your portlet application.

In the debugger view shown in Figure 4, a breakpoint has been reached in a JSP.

Deploying the Favorites Portlet Application
Once the portlet application code is complete, the application can be deployed to a production portal server. You'll need to log on to the portal server, install the portlet application, and activate the application (see Figure 5). The portlet application is now available to all portal users!

The Portal Toolkit for WebSphere Portal Version 4.1 is the first release specifically designed for portlet application development. It is an extension package that adds on to WebSphere Studio Application Developer and provides significant, powerful tools for the creation of portlet applications, including application draft creation, HTML and JSP content creation, and portlet application debug and deploy functions.

In future releases, IBM will enhance the functions of the Portal Toolkit to further enhance developer productivity, including:

  • Advanced portlet application samples
  • Support for advanced portlet user interfaces
  • Rapid application development (RAD) portlet application development tools

If you're developing portlet applications for WebSphere Portal, then the Portal Toolkit is a must-have in your selection of software development tools!

More Stories By David B. Lection

David B. Lection is a senior software
engineer at IBM Corporation. David is the lead development architect
for the WebSphere Everyplace Access and Portal Toolkits.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.