+

Search Tips   |   Advanced Search

Customize error messages for Web Content Viewers

If an error occurs during rendering, the Web Content Viewer shows an error screen. We can customize the default error screen, and we can create our own custom JSP file used to display error messages. The default error screen provides a standard error message, which is shown on every type of error, and a more detailed error message. The detailed error message provides information about the cause of the error and is displayed when click the View details link.

  1. Create a customized error JSP file.

    1. Copy the original error.jsp file from...

        wp_profile_root/installedApps/node/PA_WCMLRingPortJSR286.ear/ilwwcm-localrende.war/jsp/html

    2. Modify copy of error.jsp file according to the requirements.

      To show the cause of the error, capture the message in a variable:

        <%-- use errorbean from request --%>
        <jsp:useBean scope="request" type="com.ibm.portal.portletui.messages.StatusMessageBean" />
        <% String msg = errorbean.getMessage(); %>

      The variable msg contains the message text of the error.

      In the original error.jsp file, this message is only shown in a separate window if a user selects the View details link.

    3. Add code to parse the message and replace with our custom message.

  2. Configure the Web Content Viewer to use the customized error JSP file.

    1. Log in to the portal as an administrator and go to:

        Administration > Portlet Management > Portlets > Web Content Viewer > Configure Portlet

    2. Edit the value of the ERROR_JSP parameter, and set the path to the customized error JSP file as the parameter value.

      JSP files are stored within a web application that runs on the portal. To reference a JSP file in another web application, use the following path: contextPath;jspPath. For example:

        /wps/customapplication;/jsp/jspFilename.jsp

      A dynamic context path value can be defined by adding a token to the context path that corresponds to a key and value pair to the WCM configuration service environment provider. When this key is used as the token in the jsp value field, it is replaced dynamically at render time. For example: [my.custom.key];myfile where my.custom.key is a constant within the WCM configuration service.


Parent Customize web content delivery