IBM WebSphere Portal is bundled with a number of useful portlets for external connections, integration, and Internet/intranet tools. But sometimes your needs go beyond what these bundled portlets can accommodate, and you have to build your own portlet. By comparing the design techniques of IBM Lotus Domino and IBM WebSphere Portal, this article helps an experienced Lotus Domino developer start developing portlets for WebSphere Portal or any other Java Specification Request (JSR) 168-compatible Java 2 Platform, Enterprise Edition (J2EE) portal.
This article targets experienced IBM Lotus Domino developers who are proficient with Lotus Domino but who want to use IBM Rational Application Developer for WebSphere Software for portlet creation. Because of the more complex nature of a Java project involving relational databases, we advise you to start reading about databases, JavaServer Faces (JSF), and portlets before starting the development client. We expect that you have experience and knowledge working with Lotus Domino technology and are familiar with the Java language. We also expect that you understand the user interface in Rational Application Developer. We assume youâve created a JSR 168 JSF-enabled portlet project in Rational Application Developer and that youâve switched to the Web perspective. Your screen should be similar to the one shown in figure 1.
Figure 1. Newly created JSR 168 JSF-enabled portlet

Comparing performance in IBM Lotus Domino and IBM WebSphere software
Development in Rational Application Developer targeting WebSphere Portal is not as fast as youâre probably used to in the Lotus Domino environment. For example, in production, you cannot correct a small spelling mistake, change a color, or make any other small, quick fixes that you can do in Lotus Domino. And some things are really time-consuming. For example, the widely used âDisplay values as iconsâ function in a Domino view column is a quick way to give the user a great experience when using your application, but developing a similar function in a portlet takes time.
IBM WebSphere Portal, on the other hand, supports JSF, which has some nice features. For example, JSFâs datatable component allows you to create something similar to Lotus Dominoâs embedded view, but directly from a data source or any list of Java objects. Developing an application that connects to and retrieves data from a third-party data source takes time in Lotus Domino because it involves agents, forms, and views. In addition, while Lotus Domino embedded views make it difficult to separate content from presentation, the nature of a JSF component makes it hard to mix presentation with content, leading to a much better architecture.
Sorting and filtering in an agent in the Java environment are expensive, and Lotus Domino developers often prefer creating another view or folder, so the server can sort the data in the background. This, however, can result in a heavy server load and unpredictable quirks when the indexer task simply canât keep up. On the other hand, using Java Database Connectivity (JDBC) to connect to a relational database in WebSphere Portal is fast, and the nature of SQL allows you to write SQL queries with different sorting and filtering at no discernable cost. Not to mention, the complete built-in support for Web services makes WebSphere Portal well suited for Service-Oriented Architecture (SOA) applications.
Transitioning from documents to relational databases
When experienced Lotus Domino developers start to work with another platform, their biggest challenge is understanding how relational databases compare to Lotus Notes databases. Even though the goal of this article is not to explain how a relational database works in detail, a brief overview is in order.
Understanding the relational database structure
A well-structured relational database has a number of tables that you use in relations to find the data of interest. As an example, letâs take a look at an account manager register (see tables 1 and 2). The CONTACTS table holds all personal information, and the COMPANIES table contains information about companies. The two tables are related (joined) because the COMPANY column in the CONTACTS table points to the IDX column in the COMPANIES table.
Table 1. CONTACTS table
| IDX | FIRSTNAME | LASTNAME | COMPANY |
|---|---|---|---|
| 0 | Adam | Adamson | 2 |
| 1 | Joe | Smith | 1 |
| 2 | William | Jones | 2 |
| 3 | Anders | Anderson | 1 |
Table 2. COMPANIES table
| IDX | COMPANYNAME | PHONE NUMBER |
|---|---|---|
| 0 | Acme Inc | (555)123 456 7 |
| 1 | Dagerot AB | (345) 875 578 |
| 2 | Citrus ltd | (677) 6876 6876 |
You can retrieve a list of data that contains first name, last name, and company name by using this SQL query:
select firstname, lastname, company from contacts, companies
where contacts.company = companies.idx
In a Lotus Domino application, you typically accomplish the same thing by copying the company data into the user document when either is updated, so that the company data can be listed in the same view as the user data. Or, if the view listing isnât important, you perform a set of @DbLookup commands when the user document is open, making a view listing of both the company details and the user details impossible.
To make this example more complex, letâs say that each manager, or user, may be responsible for more than one account. In this case, a third table (a Link Table) is useful (see tables 3, 4, and 5). The COMPANYMANAGER table, shown in table 5, specifies the relationship between the managers and the companies.
Table 3. MANAGER table
| IDX | FIRSTNAMELASTNAME |
|---|---|
| 0 | AdamAdamson |
| 1 | JoeSmith |
| 2 | WilliamJones |
| 3 | AndersAnderson |
Table 4. COMPANY table
| IDX | COMPANYNAMEPHONENUMBER |
|---|---|
| 0 | Acme Inc(555) 123 456 7 |
| 1 | Dagerot AB(345) 875 578 |
| 2 | Citrus ltd(677) 6876 6876 |
Table 5. COMPANYMANAGER table
| MANAGER | COMPANY |
|---|---|
| 0 | 0 |
| 0 | 1 |
| 1 | 2 |
| 2 | 2 |
Suppose you want to find out which accounts Adam Adamson runs. You use a SQL query such as the one shown in listing 1.
Listing 1. SQL query to identify accounts
select c.companyname, m.firstname, m.lastname from manager m inner join companymanager cm on m.idx = cm.manager inner join company c on c.idx = cm.company where m.idx = 0 |
Finding out this information is more difficult to accomplish in a Lotus Domino application because it contains no relations. You probably have to shuffle the data between the manager and the company documents either on a scheduled basis or when a change triggers it, which probably results in inconsistent data sooner or later.
Comparing design elements in Lotus Domino and WebSphere applications
On first impression, it might seem that Domino Web applications and WebSphere applications are similar because they both deliver HTML; however, if you choose not to go with JSF, the similarities end there. On the other hand, if you decide to use JSF in your application, you find some similarities in how you create, configure, and populate design elements. In particular, letâs examine the IBM WebSphere Combo Box element, which is similar to Lotus Dominoâs Dialog list.
In Lotus Domino, a drop-down field is called a Dialog list, and in WebSphere, itâs called a Combo Box. On both platforms, itâs possible to hard-code values to the list. Figure 2 shows the property settings for both hard-coded and dynamic values for a Dialog list in Lotus Domino.
Figure 2. Hard-coded and dynamic values displayed in Lotus Domino

When working with a JSR 168 portlet, JSF offers a similar solution called a Combo Box. Figure 3 shows how you can configure a Combo Box when you want the values to be dynamic.
Figure 3. Configuring a Combo Box in Rational Application Developer

You can find JSF components under the Palette to the right in your client. As figure 4 illustrates, you can find the Combo Box component under the Faces Components category.
Figure 4. Finding the Combo Box on the Palette panel

When it comes to driving dynamic data to the JSF components, you could use a number of different solutions. You can connect your component directly to a Java Naming and Directory Interface (JNDI) data source, or you can feed it from a managed bean. A bean is a Java class that helps the JavaServer Pages (JSP) file communicate with the back end. Listing 2 is an example of a simple bean that keeps a list of values:
Listing 2. Example of a bean
package pagecode;
import java.util.ArrayList;
import java.util.List;
public class Items {
private List items = new ArrayList();
public Items() {
this.getItems().add("My first value");
this.getItems().add("My second value");
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
}
|
In the previous code, the items were added during the initialization of the bean. In the real world, that information would have been loaded from a database, Web service, or something similar.
To get the Combo Box to use this bean, you need to make the bean managed. You do this from the Page Data panel in the bottom left area; in the Scripting Variable list, right-click the sessionScope option, and then select new - JavaBean.
After you configure the managed bean, you must add it to the JSP file youâre working with. Drag the bean from the Page Data panel onto your JSP page in the editor. You can now semi-automatically bind the bean data to the Combo Box by selecting the Combo Box and right-clicking the items bean in the Page Data as figure 5 shows.
Figure 5. Adding the managed bean to the JSP file

As you can see from figure 5, you can also populate a table directly from the managed bean. To do this, you simply drag the managed bean to the JSP page, and a wizard shows up as figure 6 demonstrates.
Figure 6. Using a wizard to add data to a JSP page

If the bean were of a more complex type -- for example, if the list were populated with a complex type class with many properties -- then this wizard would allow you to pick whatever columns you wanted to show. This is similar to embedding a view into a form in Lotus Domino, but it offers much more flexibility.
One of the benefits of using IBM Lotus Domino Designer is that you can do almost all your development with just one installed client. Many applications donât need to be hosted on a staging server before being put into production. Lotus Domino Designer and its preview functionality address all testing and debug needs quite well. Rational Application Developer isnât entirely complete when itâs first installed. You must install a test server on top of it. When you do that, the whole portal framework runs locally, and you can test your applications in a near-production status environment. (See the Resources section for references to an article that shows how to install the test environment.)
When developing a page or other design element in Lotus Domino Designer, you can open the specific design element in either a Web browser or the Notes client.
Rational Application Developer gives you many more ways to see how the JSP file will look. You can work with it in the WYSIWYG Design mode, which is close to the real outcome, or you can choose to work with it in Source mode, which shows all the markup and gives you 100% control. The best option, though, is the Preview mode, which is built into the editor and shows the JSP just as it would look in production. Figure 7 shows a cropped and somewhat manipulated overview of the three design modes that Rational Application Developer provides.
Figure 7. The three design modes of Rational Application Developer for WebSphere Software

In Lotus Domino Designer, when you select Preview in the default browser, the whole application starts, and you can click around in the complete application. All agents, such as any WebQueryOpen and WebQuerySave agents, are executed. The only thing that really doesnât fit in is the access control list (ACL).
To accomplish the same complete testing and debugging functionality in Rational Application Developer as in Lotus Domino Designer, you must deploy your whole portlet to the test server installed on your machine. You do this by right-clicking the project in the Project Explorer panel and choosing Run - Run on Server.
This brings up a dialog box, where you can pick the server to which you want to deploy the portlet. In most cases, this is always the locally installed test server. Figure 8 shows the details.
Figure 8. Selecting the server

Simply select the correct server instance and click Finish to start the portlet test environment.
A mature, pure Java development client such as Rational Application Developer for WebSphere Software excels at debugging. Simply open the Debug perspective by choosing Window - Open Perspective - Other and selecting Debug. Your Rational Application Developer environment looks like the one shown in figure 9.
Figure 9. Navigating to the Debug perspective

IBM Lotus Domino is still one of a kind when it comes to rapid application development, but Rational Application Developer offers freedom and flexibility so you can concentrate on solving user and business problems instead of trying to make a relational database out of a Notes database. We hope that this article has shown how you can approach portlet development from a Lotus Domino developerâs point of view and how you can create portlets in WebSphere Portal.
Learn
-
Read the article, âConfiguring the WebSphere Portal 5.1 Test Environment."
-
Learn more about Rational Application Developer for WebSphere Software.
-
Read the article, âPortlet Development Workbookâ by Tim Hanis.
Get products and technologies
-
Build your next development projects with IBM trial software, Rational Application Developer for WebSphere Software.
Discuss
Joachim Dagerot is a system architect and technical lead for Strand Interconnect. He has been involved in worldwide intranets that serve more than 130 million users. These days, he primarily focuses on Web development, with particular interest in accessibility and standard compliance. In his spare time, he develops Web services and blogs at domino.dagerot.com. You can reach Joachim at jd@dagerot.com.
Comments (Undergoing maintenance)





