cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dada <sw0...@uni-essen.de>
Subject Re: ESQL:ERROR-RESULTS
Date Sat, 25 Nov 2000 23:53:20 GMT


Donald Ball wrote:

> if you include an esql:error-results element, any SQLExceptions that are
> thrown while executing a query or accessing its results will be caught
> there and your error-results section will be instantiated. esql makes no
> attempt to catch any other exceptions, and if you include no error-results
> sections, even SQLExceptions will be tossed upwards. if you want your page
> to do fancier error processing, simply enclose the relevant sections of
> your esql elements with try/catch blocks.
>

How to do it ?
Please give an example for :

<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-format type="text/xml"?>

<xsp:page
  language="java"
  xmlns:esql="http://apache.org/cocoon/SQL/v2"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core">



<PAGE>


<FIRMA>


<esql:connection>

<esql:execute-query>

<esql:driver>COM.ibm.db2.jdbc.net.DB2Driver</esql:driver>
<esql:dburl>jdbc:db2://localhost:6789/<xsp:expr>request.getParameter(&quot;database&quot;)</xsp:expr></esql:dburl>

<esql:username>Administrator</esql:username>
<esql:password><xsp:expr>request.getParameter(&quot;passwort&quot;)</xsp:expr></esql:password>




<esql:query><xsp:expr>request.getParameter(&quot;anfrage&quot;)</xsp:expr></esql:query>







<esql:results>




<ARBEITER>

<EMPNO><esql:get-string column="1"/></EMPNO>
<EMPNO><esql:get-string column="2"/></EMPNO>
<EMPNO><esql:get-string column="3"/></EMPNO>

</ARBEITER>



</esql:results>



<esql:no-results>
<error>keine Ergebnisse zu ihre Anfrage gefunden!!! </error>
</esql:no-results>

<esql:error-results>

<message>

<!-- esql:get-message/ -->

<xsp:logic>

    String p = "" ;

    if(request.getParameter("passwort").equals(""))  {
         p = "Passwort vergessen";
        <message><xsp:expr>p</xsp:expr></message>
                                                                           }

</xsp:logic>

<xsp:logic>

    String a = "" ;

    if(request.getParameter("anfrage").equals(""))  {
         a = "Anfrage vergessen";
        <message><xsp:expr>a</xsp:expr></message>
                                                                           }

</xsp:logic>


<xsp:logic>

    String d = "" ;

    if(request.getParameter("database").equals(""))  {
         d = "Datenbank vergessen";
        <message><xsp:expr>d</xsp:expr></message>
                                                                           }

</xsp:logic>




</message>

</esql:error-results>

</esql:execute-query>

</esql:connection>

</FIRMA>


</PAGE>


</xsp:page>


>

Thank you very much .

>
> dada
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message