Adding Custom Dynamic Content to a Theme

David Wilkerson

 by David Wilkerson, CTO

One purpose of theme customization is to enrich a site by delivering some content ubiquitously. Though delivery of most content is accomplished through portlets delivery, in a theme provides delivery of the same content throughout pages in the site that employ the same theme. That is, as a user navigates from page to page, certain content is consistently displayed.  Out of the box examples of this approach are illustrated by the search widget, help link, username display, etc.

There are two logical approaches to delivering content in a theme: client-side logic and server-side logic. Client-side logic consists of JavaScript, iWidget, and live text that is stored in a WebDAV file store and is referenced in the file theme.html. A significant benefit of client-side logic is offloading of content aggregation to the browser. Further, the development of these components can be delegated to web designers using conventional web design tools.

Server-side logic consists of Java Server Pages (JSPs). JSPs cannot be stored in WebDAV and directly referenced in the file theme.html, as they rely on a servlet context for lifecycle events.

In many cases an organization may have an existing repository of JSPs they wish to leverage in their new customized WebSphere Portal theme. To do this there are three tasks to perform: develop the content such as a JSP, configure the application server environment, and insert dynamic content spots into the file theme.html.

A web application developer can create the JSPs and related resources for delivery of dynamic content. Additionally, such a developer may be engaged to customize other dynamic providers associated with a custom theme. These artifacts are deployed in a WAR which is a member of an EAR file. The operational management and deployment of theme artifacts is covered in the supplemental documentation for the product here.

A WebSphere administrator will log on to the Integrated Solutions Console of the application server and navigate to: Resources -> Resource Environment -> Resource environment providers -> WP DynamicContentSpotMappings.

A new Custom Property will be defined by entering an arbitrary name to serve as the ID of the mapping. In addition, a URI value used to locate the dynamic content is entered.  The format will vary but the syntax is similar to this:


The third task is to define the dynamic content spot in the theme.html file. This task will require knowledge of the dynamic spot mapping ID defined by the administrator. The following is an example of a dynamic content spot tag:

<link rel=”dynamic-content” href=”dyn-cd:id:<mapping-ID-provided-by-administrator>

If you are developing on a live server, clear the browser cache, and load the page bound to your custom theme to view the result.

This article is from our monthly resource e-Newsletter. Did you miss it in your inbox? Visit our eNewsletter archives for past editions or if you want to receive our monthly newsletter automatically, simply write to Ruth Jarvis and request to be added to our E-Newsletter list. Thank you!

One comment on “Adding Custom Dynamic Content to a Theme

  1. thank you for the tip! …but I have a problem, I’m working with Portal 8… in order to get available a custom dynamic content spot, is it strictly necessary to restart the portal server after adding the new custom property in WP DynamicContentSpotMappings resource provider? I created the property and added the tag to my theme.html but it doesn’t display the contents of the associated jsp. So I want to know if I have to ask a restarting for the Portal server because is a production environment. Thanks in advanced!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s