Thursday, June 4, 2009

Customizing the Portlet Unavailable message

How can you provide a different error message than Portlet Unavailable, based upon the portlet involved?

You have a few options to customize the Portlet Unavailable message. First, look at one of your skins, such as the following one:


In that location is the control.jsp file that calls the portlet to render with the following tag:

Therefore, the body of the tag is only rendered if the portlet has a problem. The program uses a key passed by the portal engine to determine what value to pull from the resource bundle. More information on the problem format tag can be found in the Information Center topic " tags."

So, you could create a new skin for your specific portlets and enter your own custom text there. Or you can use the fmt tags and pull a different key from the regular text bundle.

All of these resource bundles are stored in the wp.ui.jar file in the portalserver/shared/app directory.

For the English language, you use the file. In that file, you see the following line:

    portlet.not.available = This portlet is unavailable.

You can change that text to whatever you wish. Note that the text you enter will be the same for every portlet that is unavailable.

If you want only the Web Content Management (WCM) portlets to return a different message, you need to replace this line:

With something like the following:

Then you add a line to the file in wp.ui.jar like this:

    wcmproblem = The WCM portlet could not be rendered

You would need to add a line like that to every language file for

You can also suppress the Portlet Unavailable error messages.