About Catch Named Child

Use the catch component inside a try component .

The catch component is a wrapper element for the content to render if an exception occurs while rendering the main contents. It must contain a single element. The preferred component to insert is a displayException element.

When rendering the catch section, the "ui:currentThrowable" RenderingContext property provides the exception that caused the catch child to display.


Example:

...
<page xmlns="http://xmlns.oracle.com/uix/ui" 
      xmlns:ui="http://xmlns.oracle.com/uix/ui" 
      expressionLanguage="el">
  <content>
    <body xmlns="http://xmlns.oracle.com/uix/ui" 
          xmlns:data="http://xmlns.oracle.com/uix/ui" 
          xmlns:ui="http://xmlns.oracle.com/uix/ui">
      <contents>
        <dataScope>
          <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>
            <!-- But this "try" will fail --> 
            <try>
              <contents>
                <!-- something that might trigger an error -->
                <pageLayout>
                  <contents>
                    <styledText text="${uix.data.problem['1Text']}" /> 
                  </contents>
                </pageLayout>
              </contents>
              <catch>
                <!-- So you'll reach this portion --> 
                <displayException />
              </catch> 
            </try>
          </contents>
        </dataScope>
      </contents>
    </body>
  </content>
</page>
...    

Using Try, Catch, and DisplayException
Working with Simple and Miscellaneous Components

 

Copyright © 1997, 2004, Oracle. All rights reserved.