Skip to main content

IBM WebSphere portlet development for IBM Lotus Domino developers

Joachim Dagerot (jd@dagerot.com), System Architect and Technical Lead, Strand Interconnect
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.

Summary:  Compare the design techniques and development steps of IBM Lotus Domino and IBM WebSphere Portal as you build your own portlet. The article also covers how to use IBM Rational Application Developer for WebSphere Software for greater freedom and flexibility.

Date:  13 Mar 2007
Level:  Intermediate
Activity:  2017 views

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
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
IDXFIRSTNAMELASTNAMECOMPANY
0AdamAdamson2
1JoeSmith1
2WilliamJones2
3AndersAnderson1


Table 2. COMPANIES table
IDXCOMPANYNAMEPHONE NUMBER
0Acme Inc(555)123 456 7
1Dagerot AB(345) 875 578
2Citrus 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
IDXFIRSTNAMELASTNAME
0AdamAdamson
1JoeSmith
2WilliamJones
3AndersAnderson


Table 4. COMPANY table
IDXCOMPANYNAMEPHONENUMBER
0Acme Inc(555) 123 456 7
1Dagerot AB(345) 875 578
2Citrus ltd(677) 6876 6876


Table 5. COMPANYMANAGER table
MANAGERCOMPANY
00
01
12
22

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.

Driving dynamic data

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
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
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
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
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
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.


Previewing and test running

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
The three design modes of Rational Application Developer for WebSphere Software

Running the logic

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
Selecting the server

Simply select the correct server instance and click Finish to start the portlet test environment.


Debugging

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
Navigating to the Debug perspective

Conclusion

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.


Resources

Learn

Get products and technologies

Discuss

About the author

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)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus, WebSphere
ArticleID=201778
ArticleTitle=IBM WebSphere portlet development for IBM Lotus Domino developers
publish-date=03132007
author1-email=jd@dagerot.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers