Flylib.com

Books Software

 
 
 

Chapter 2. Portlet API

 <  Day Day Up  >  

Chapter 2. Portlet API

This chapter provides details on the Portlet life cycle, Portlet API and deployment concerns.The goal of this chapter is to provide you with the ability not only to design and build dynamic portlet applications, but also to recognize opportunities to portalize existing applications and services.

At the end of this chapter, you should be able to work with the Portlet API to design and build new portlet applications. You will have the requisite skills to deploy new applications as well as existing portalized applications. The WebSphere Studio Application Developer environment is covered in Chapter 3, "Portal Toolkit" on page 125 and as such will not be discussed here. In this chapter, all development and deployment information will be development environment independent.

 <  Day Day Up  >  
 <  Day Day Up  >  

2.1 What is a portlet?

A portlet is a server side application that runs in the context of the WebSphere Portal Server. It inherits from the javax.servlet.http.HttpServlet class and as such is treated as a servlet by the application server. The portlet is executed inside a Web container managed by the application server. In the Portlet API, this container is referred to as the Portlet container.

Note : It is not possible to directly execute the portlet functionality by addressing the portlet via http.

Though a portlet may provide dual functionality as both a servlet and a portlet, it is certainly best practice to keep these controller functions separate. A portlet is visible on a portal page as a single small window, of which each portal page may have many. The portlet is the content inside the window, not the window itself. The window is defined by the selected skin.

 <  Day Day Up  >  
 <  Day Day Up  >  

2.2 Basic portlet terms

In order to fully understand some of the introductory topics, it is necessary to define a few of the most basic terms used when discussing portlets.

Portlet window

This is the window that surrounds the portlet, including the title bar and any border images.

State

This is the current state of the portlet window. Valid states are Normal, Minimized and Maximized.

Mode

This defines the current condition of the portlet. The modes that are available for any particular user depend on the permissions for that user , the device used to access the portlet and the configuration and implementation of the portlet.

Note

All portlets support the default mode, View.


The following portlet modes are supported:

  • View . When a user is simply viewing the portlet, likely with other portlets on the page, it is in View mode.

  • Edit . When the user selects the Edit button to change some configuration information, the portlet is in Edit mode. Users only have access to the Edit mode if they have been granted edit access by the administrator.

  • Configure . The Configure mode is conceptually similar to Edit mode in that it is used to adjust the configuration of the portlet. However, only users with manage permissions on a portlet have access to the Configure mode. In practice, the average user may have edit permissions on a portlet to change certain personal settings such as user IDs and passwords. Typically, only administrators would have manage permissions on a portlet in order to adjust non-user specific settings such as server names , etc. The actual implementation of the Edit and Configure modes, however, is entirely up to the portlet developer.

  • Help . The Help mode is used to present help information.

 <  Day Day Up  >