Error handling in the messaging system composition service

When an error occurs in the processing of a JavaServer page, the result of the page typically contains extensive information generated when the system is running. If this is not the desired result on a JavaServer page failure, there are two potential approaches to make the behavior more predictable.

In the first approach, you can specify an error page in your JavaServer page, which runs if an unanticipated error is encountered, such as an uncaught exception. To use this approach, include the following line in your main page:

<%@ page errorPage="YourError.jsp" %>

You also need to include the following line in YourError.jsp:

<%@ page isErrorPage="true" %>

Note: In the event of an error, the result of the message composition is the result of YourError.jsp. For more details please see the JSP 1.0 specification.

In the second approach, instead of having the error message processed as an outbound message, you can use an error JavaServer page that generates output that is processed as an exception. To do this, use the ComposerError.jsp as the basis for handling the error. Do this the same way as described above, but the beginning of YourError.jsp should start with the first two lines of ComposerError.jsp. This allows the composition runtime to detect that an error occurred, and to raise an exception. The ComposerError.jsp can be found in the following directory:

The first two lines of the ComposerError.jsp are as follows:

ERROR
<%@ page isErrorPage="true" %>

To use this file, you can indicate that it is the error page by setting errorPage="ComposerError.jsp" in the main JSP page. If you want extra information, you can copy this file to another filename, such as YourError.jsp, and place the extra error information after these two lines in the new file. You would then set errorPage="YourError.jsp" in the main JSP page. Any extra output specified after these two first lines will be part of the text of the exception thrown by the composition service.