Monday, October 31, 2011

What Is a Portlet - O'Reilly Media

What Is a P
Portlets
"Portlets are web components--like servlets--specifically designed to be aggregated in the context of a composite page. Usually, many portlets are invoked to in the single request of a portal page. Each portlet produces a fragment of markup that is combined with the markup of other portlets, all within the portal page markup." (from the Portlet Specification, JSR 168)

This article discusses the following:

  1. Elements of a Portal Page
  2. What Is a Portal?
  3. What Are Portlets?
  4. Developing a "Hello World" Portlet
  5. Deploying a HelloWorld Portlet on Pluto
  6. How a Portal Page Is Created
  7. Conclusion
  8. Resources

The Portlet specification defines a portlet as a "Java-technology-based web component, managed by a portlet container that processes requests and generates dynamic content." That's not the easiest thing to understand, is it? This article will explain what portlets are and what they do.

Figure 1 shows what your browser will look like when you access a portal server.

Thumbnail, click for full-size image.
Figure 1. Typical portal server content (click for full-size image)

If you take a closer look at the browser content, you will see that this page is made up of different "windows." There is one window for the weather update, another window for news, a third for a stock price update, and so on. Each of these windows represents a portlet. If you take closer look, you will find that each of these windows has a title bar and a few buttons, including minimize and maximize buttons.

Under the covers, these windows are different applications, developed independently of each other. The developer of the news portlet will create an application and pack it into a .war file. Then the administrator of the portal server will install this .war file on the server and create a page. In the next stage, every user will choose which applications he wants on his page. For example, if the user is not interested in stock updates but is interested in the sports update, he can replace his "Stocks Update" window with a "Sports Update" window.

Portlet technology requires learning a lot of new concepts, and it won't be possible for us to cover everything in one article, so we have split this article into two parts. In this part, we will define portals and portlets and develop a simple "Hello World" portlet. We will talk about a few more advanced topics in the next part.

We will use Apache's Pluto server--the reference implementation of the Portlet API 1.0 specification--for testing our sample portlets. We will also spend some time talking about how to install and use the Pluto server.

Elements of a Portal Page

Figure 2 shows the various elements of portal page.

Elements of a Portal page
Figure 2. Elements of a portal page

Every portlet page is made up of one or more than one portlet windows. Every portlet window is made up of two parts: one is the decoration, which will decide how the title bar, controls, and borders of portlet windows will appear. The second part is the portlet fragment, which is the part contributed by the portlet application.

Your portal server decides the overall look and feel of the portal page, such as the logo, the colors of the title bars, the images for the controls, etc. By changing a few standard JSPs and .css files, you can change the complete look and feel of your portal. We will talk more about this in the "How a Portal Page is Created" section.

ortlet - O'Reilly Media

No comments:

Post a Comment