JBoss.org Community Documentation

3.2.2.7.1. Error handling during render

Simple Portal can display the content of an alternative page if, for some reason, a portlet fails during the render phase. This is similar to JSP error pages.

Several request attributes are set by Simple Portal so that the markup of the error page can be customized appropriately. The following table sums up these request attributes and their meaning.

Attribute name Meaning
org.jboss.portal.portlet.portal.error.status A <className>String</className> containing the error category as detailed in Table 3.1, “Error Categories”
org.jboss.portal.portlet.portal.error.cause A (possiblynull) <className>Throwable</className> representing the cause of the error, for example, a portlet exception
org.jboss.portal.portlet.portal.error.message A <className>String</className> containing the error message, if any
org.jboss.portal.portlet.portal.error.portlet_name A <className>String</className> containing the name of the portlet that generated the error, as defined on the associated portlet tag
org.jboss.portal.portlet.portal.error.application_name A <className>String</className> containing the name of the portlet application that generated the error, as defined on the associated portlet tag
org.jboss.portal.portlet.portal.error.window_id A <className>String</className> containing the identifier of the window associated with the portlet that generated the error, especially useful when several portlet windows reference the same portlet

Table 3.2. Request Attributes for Error Pages


The errorPage attribute of the portlet tag is used to specify which error page to use for this specific portlet. The value of the attribute should be the path to the error page relative to the root of the WAR file for that portlet. Note that it could be a JSP or a plain file.

<portal:portlet name="JSPPortlet" applicationName="samples-jsp-portlet" errorPage="/WEB-INF/jsp/error.jsp">
   ...
</portal:portlet>

Example 3.6. Defining an error page