ConcourseConnect

Open Source Initiative (OSI) PostgreSQL Java

Building your first portlet

We've included an example portlet called DebugPortlet as a demonstration of a few key portlet capabilities. Portlets typically render HTML first, and then respond to POSTs when needed.

All portlets extend a standard interface, either directly or indirectly, called javax.portlet.GenericPortlet.

An example portlet

For example, here's the latest DebugPortlet code:

AboutPortlet.java

To register the portlet with ConcourseConnect, the standard requires registering the Portlet with the Portal Container and with the Web App Container, as seen here:

/WEB-INF/portlet.xml

/WEB-INF/web.xml

Once the Portlet is defined and made available to the web application, typically in a separate .jar file, the portlet can be added to the page layout file. Here's an example page layout file:

/resources/portal/dashboards_en_US.xml

Portlet Methods

doView handles basic requests, doEdit handles requests in which the user wants to interactively edit the parameters of a portlet, doHelp handles requests for displaying helpful information about the use of the portlet to an end user, and processAction handles POSTs.

ConcourseConnect makes heavy use of doView and processAction. The editing of the portlet configuration is done programmatically through XML and is not exposed to end users.

ConcourseConnect also includes com.concursive.connect.web.portal.AbstractPortletModule so that portlets can be built with an MVC model. With MVC, the developer codes Viewers and Actions in separate Classes instead of one large Portlet Class. MVC also automates populating beans and sharing them between views and actions.

Sign in to add your comment.