To insert a try component and use catch and displayException:
The try node is inserted and highlighted under the expanded parent node.
The displayException node is inserted and highlighted under the expanded catch node.
Note: To use data binding, see Data Binding a Component Attribute.
...
<page xmlns="http://xmlns.oracle.com/uix/ui"
xmlns:ui="http://xmlns.oracle.com/uix/ui"
expressionLanguage="el">
<content>
<dataScope xmlns="http://xmlns.oracle.com/uix/ui">
<provider>
<!-- A data provider that will always fail, throwing a SQLException -->
<data name="problem">
<method class="oracle.cabo.servlet.demo.DemoData"
method="throwException" />
</data>
<!-- A data provider that succeeds -->
<data name="noproblem">
<instance class="oracle.cabo.servlet.demo.DemoData" />
</data>
</provider>
<contents>
<!-- This "try" will succeed without any problems -->
<try>
<contents>
<pageLayout>
<contents>
<styledText text="${uix.data.noproblem['1Text']}"/>
</contents>
</pageLayout>
</contents>
<catch>
<!-- So you'll never see this -->
<messageBox text="An error!" />
</catch>
</try>
<!-- But this "try" will fail -->
<try>
<contents>
<pageLayout>
<contents>
<styledText text="${uix.data.problem['1Text']}"/>
</contents>
</pageLayout>
</contents>
<catch>
<!-- So you'll reach this portion -->
<header messageType="error">
<!-- And here's a simple example of getting the exception that caused the problem -->
<boundAttribute name="text">
<contextProperty select="ui:currentThrowable" />
</boundAttribute>
</header>
<!-- or this section -->
<!--catch>
<displayException />
</catch-->
</catch>
</try>
</contents>
</dataScope>
</content>
</page>
...
About Try
About
Catch
About DisplayException
Working with Simple and Miscellaneous Components
Copyright © 1997, 2004, Oracle. All rights reserved.