cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magnus.egnerf...@home.se
Subject Problem with esql-taglib
Date Mon, 16 Oct 2000 10:58:17 GMT

Hello,

 I have a problem that I have been working on for a few days now so any
help solving this would be great. I'm running with cocoon-1.8.1-dev
(updated this morning/ unfortunately there is a problem with
turbine-pool.jar that I've posted to cocoon-dev list).

The problem occurs when using the esql and session taglib together.

Here is my XML document (the document is a test page normally there should
be some xslt processing to add the html headers). The msisdn variable is
set in the session on the previous page and is fetched correctly.

-----XML document ----------
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?xml-logicsheet
href="resource://org/apache/cocoon/processor/xsp/library/java/session.xsl"?>
<?xml-logicsheet
href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>

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

<page>

<html>
<body>

<P><session:get-attribute name="msisdn"/></P>
<P>select * from msisdn2contract where msisdn='<session:get-attribute name="msisdn"/>'</P>

<esql:execute-query inner-method="yes">
<esql:driver>oracle.jdbc.driver.OracleDriver</esql:driver>
<esql:username>sysadm</esql:username>
<esql:password>sysadm</esql:password>
<esql:dburl>processor.xsp.pool.database.default.url=jdbc:oracle:thin:@localhost:1521:ERWIN</esql:dburl>
<esql:query>select customerid from msisdn2contract where msisdn='<session:get-attribute
name="msisdn"/>'</esql:query>
<esql:results>
<P><esql:get-string column="customerid"/></P>

</esql:results>
<esql:no-results>
 <error>no results were found here either</error>
</esql:no-results>
<esql:error-results>
 <message><esql:get-message/></message>
 <stacktrace><esql:get-stacktrace/></stacktrace>
</esql:error-results>
</esql:execute-query>


</body>
</html>
</page>

</xsp:page>

----------end xml doc -----------------------

This generates a page that looks like this:

----------- output --------------
<page xmlns:session="http://www.apache.org/1999/XSP/Session">

<html>
<body>

<P>628882101</P>
<P>select * from msisdn2contract where msisdn='628882101'</P>

<error xmlns:session="http://www.apache.org/1999/XSP/Session">no results
were found here either</error>

</body>
</html>
</page>
-----------end output --------------

When checking the java source for this page it looks alright the
interesting section here:

------------- java code ---------------
  _esql_session.query = String.valueOf(""
                        + "select customerid from msisdn2contract where 
msisdn='"
                        + session.getAttribute(
                              String.valueOf("msisdn")
                          )
                        + "'");
                 _esql_session.statement =
_esql_session.connection.createStatement();
                 _esql_session.resultset =
_esql_session.statement.executeQuery(_esql_session.query);
---------------------------------------


Replacing the last get-attribute with a fixed value works perfectly fine
and the query returns the correct information.

Does the esql-block create its own session somehow and we lose the session
information???

TIA

Magnus Egnerfors

-- 
Magnus Egnerfors	
Email: magnus.egnerfors@home.se



Mime
View raw message