Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XSQL Servlet, 17 of 24

## How XSQL Page Processor Processes ActionHandler Actions

Figure 19-9 shows you how the XSQL Page Processor processes the actions specified in the ActionHandlers.

1. The XSQL Page Template inputs the ActionHandler.

2. The XSQL Page Processor's "process actions" module looks for two components in the ActionHandlers:

   - `init(Element actionElt,XSQLPageRequest context`)

   - `handleAction (Node result)`

3. `init(Element action Elt, XSQLPageRequest context)`

   - First parameter: Element contains for example, the SQL query such as:

         <xsql: query max-rows="5">
         SELECT * from dual
         </xsql:query>

   - Second parameter: XSQLPageRequest contains connection and page request information, such as getAttributeAllowingParam().

4. The Action Handler outputs the resulting transformed page

#### Figure 19-9 XSQL Page Processor: Processing Actions

### XSQL Action Handler Errors

Errors raised by the processing of any XSQL Action Elements are reported as XML elements in a uniform way so that XSL Stylesheets can detect their presence and optionally format them for presentation.

The action element in error will be replaced in the page by:

    <xsql-error action="xxx">

Depending on the error the <xsql-error> element contains:

- A nested <message> element

- A <statement> element with the offending SQL statement

#### Displaying Error Information on Screen

Here is an example of an XSLT stylesheet that uses this information to display error information on the screen:

    <xsl:if test="//xsql-error">
         <table style="background:yellow">
            <xsl:for-each select="//xsql-error">
               <tr>
                <td><b>Action</b></td>
                <td><xsl:value-of select="@action"/></td>
                </tr>
                <tr valign="top">
                <td><b>Message</b></td>
                <td><xsl:value-of select="message"/></td>
               </tr>
              </xsl:for-each>
         </table>
    </xsl:if>

If your stylesheet uses an <xsl:output> element, the XSQL Page Processor infers the media type and encoding of the returned document from the media-type and encoding attributes of <xsl:output>.

### Using JavaServer Pages (JSP) and XSQL Pages

JavaServer Pages (JSP) can use <jsp:forward> to forward to an XSQL Page and <jsp:include> to include the results of an XSQL Page.

See Also: Oracle JavaServer Pages Developer's Guide and Reference

and the XML query example is in Chapter 9, "Sample Applications". There's also brief mention of OracleXMLQuery in Chapter 5, "Oracle Extensions", under "OracleJSP Support for XML and XSL".

### Using <xsql:query> Tag Attributes

Attributes of the <xsql:query> tag (or any action element) can reference parameters in the same way the SQL statement for the tag can, allowing the client to pass in values for parameters like skip-rows or any other.

Client-overriding of stylesheets for an XSQL Page can be disallowed with the new allow-client-style="no" on the document element of the page.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index