Use the try component to execute a section of a page that may throw errors. The try component lets you do this without risking incomplete output as all output is buffered until the section completes correctly.
If the output fails, rendering is deferred to the catch named child component. The catch named child has access to the exception that caused the error as a RenderingContext property, in the Marlin namespace and at the "currentThrowable" key.
In many situations, Java developers are constrained by an interface that does not allow any unchecked exceptions (for example, the UIX DataObject interface). These interfaces only allow Java RuntimeExceptions. The alternative is to use the oracle.bali.share.util.UnhandledException class to wrap the "real" exception. The try component then automatically unwraps instances of this class.
Example:
...
<try xmlns="http://xmlns.oracle.com/uix/ui">
<contents>
<!-- Assume the following request throws an exception -->
<styledText text="${uix.data.problem.veryBadKey}"/>
</contents>
<catch>
<header messageType="error">
<boundAttribute name="text">
<!-- A UIX example of an easy way to display the exception -->
<contextProperty select="ui:currentThrowable"/>
</boundAttribute>
</header>
</catch>
</try>
...
Using Try, Catch, and DisplayException
Working with Simple and Miscellaneous Components
Copyright © 1997, 2004, Oracle. All rights reserved.