Hello everybody,

I have the following problem and for me it is hard to tell where the reasons are:

I am trying to send an insert query to mySQL from an XSP-Page processed  by
Cocoon 2.

If successful the resultpage shall yield some hopebringing comment, for
example which values have been inserted.

If the update fails (because of a SQLException) I need to tell it to the user.

Therefore I have tried to use the <esql:results> and <esql:no-results> tags
from the esql-taglib (this once worked fine with Cocoon 1 and Oracle 8). But
with mySQL and Cocoon 2 it just won't work. Either I get always only success
messages even if the query fails, or no text at all.

Has anybody experiences with this or knows an answer that could help?

Thanks,
Uwe Stelzer


Here is the source of my XSP page:

--------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:esql="http://apache.org/cocoon/SQL/v2";
    xmlns:request="http://www.apache.org/1999/XSP/Request";
    xmlns:util="http://www.apache.org/1999/XSP/Util";
>

<xsp:structure>
        <xsp:include>java.lang.*</xsp:include>
</xsp:structure>

<page>
 
    <xsp:logic>
        String something = request.getParameterValues("something")[0];
    //... maybe some more variables
    </xsp:logic>

<esql:connection>
  <esql:driver>org.gjt.mm.mysql.Driver</esql:driver>
  <esql:dburl>jdbc:mysql://localhost:3306/myDatabase?user=myUser</esql:dburl>

  <esql:execute-query>
  <esql:query>
    insert into StudentTable (something)
    VALUES ('<xsp:expr>something</xsp:expr>')
  </esql:query>

  <esql:results>
    <esql:update-results>
        <success>
            <something>
                <xsp:expr>something</xsp:expr>
            </something>
        </success>
    </esql:update-results>
  </esql:results>
  
    <esql:no-results>
        <fail>
            <something>
                Oooops, database update query failed!
            </something>
        </fail>
    </esql:no-results>

 </esql:execute-query> 

</esql:connection>

</page>
</xsp:page>

--------------------------------------------------------------------------------------



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to