You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sPY <yp...@capgemini.fr> on 2001/01/10 13:53:20 UTC

generate dynamically ?

Hello everybody,

I'd like to make queries on my database, but this queries will depends on
some arguments passed to the xml like this :
    http://www.mysite.com/query.xml?ID=1&ID=3

So If I have one argument I'll have one query looking like:
    <esql:query>select * from my_table where id = 'argument'</esql:query>

If I have 4 arguments I'll have 4 queries where 'argument' will be replaced
by the value of each arguments.
...

Does anybody knows a mean to generate the xml query file dynamically
depending from the arguments and then to process these queries?
How to get these arguments and process exactly the number of queries I need
...


thank you for any help.


Re: generate dynamically ?

Posted by Matthew Cordes <mc...@maine.edu>.
This is true if you're using the esql that comes with cocoon, try the 
cvs version (1.39) and this should work.

-matt


On Wed, Jan 10, 2001 at 05:00:38PM +0100, Yann PETIT wrote:
> Thank you matt but ...
> 
> I've already tried this solution  :o(
> But in fact the values[x] are not evaluated inside an esql taglib element !
> 
> Any other ideas ?
> 
> 
> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
> 
> If I do something like :
> 
> <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID = 'T101'</esql:query>
>      <esql:results>
>       <result>
>        <Task_LIB>
>         <esql:get-string column="Task_LIB"/>
>        </Task_LIB>
>        <ID><xsp:expr>values[x]</xsp:expr></ID>
>       </result>
>      </esql:results>
>      <esql:no-results>
> 
> 
> I got the following errors ....
> 
> 
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _ultimetest.java
> 162: Undefined variable: values
> 
>           xspExpr(values[x], document)
> 
>                   ^
> 
> 162: Undefined variable: x
> 
>           xspExpr(values[x], document)
> 
>                          ^
> 
> 2 errors
> 
> 
> 
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at java.lang.Exception.(Exception.java, Compiled Code)
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> Compiled Code)
>  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
>  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>  at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
>  at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
>  at java.lang.Thread.run(Thread.java, Compiled Code)
> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
> And if I do something like
> 
> <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
> <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter></esql:query>
>      <esql:results>
>       <result>
>        <Task_LIB>
>         <esql:get-string column="Task_LIB"/>
>        </Task_LIB>
>        </result>
>      </esql:results>
>      <esql:no-results>
> 
> 
> I got this error :
> 
> 
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _ultimetest.java
> 101: ')' expected.
> 
>     xspParentNode = xspCurrentNode;
> 
>                                   ^
> 
> 1 error
> 
> 
> 
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at java.lang.Exception.(Exception.java, Compiled Code)
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> Compiled Code)
>  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
>  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>  at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
>  at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
>  at java.lang.Thread.run(Thread.java, Compiled Code)
> 
> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
> 
> yann
> 
> 
> ----- Original Message -----
> From: Matthew Cordes <mc...@maine.edu>
> To: <co...@xml.apache.org>
> Sent: Wednesday, January 10, 2001 4:12 PM
> Subject: Re: generate <esql:excute-query> dynamically ?
> 
> 
> > why not do:
> >
> >
> > <esql:connection>
> > <esql:pool>myPool</esql:pool>
> >
> > <xsp:logic>
> > String values[] = request.getParameterValues( "id" );
> >
> > for ( int x=0; x &lt; values.length; ++x )
> > {
> > <esql:execute-query>
> > <esql:query>
> > select * from my_table where id =
> > <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
> > </esql:query>
> >
> > <esql:results>
> > <!-- do stuff -->
> >
> > </esql:results>
> >
> > </esql:execute-query>
> > }
> > </xsp:logic>
> >
> > </esql:connection>
> >
> >
> > Is this basically what you're after?
> >
> > -matt
> >
> >
> >
> > On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> > > Hello everybody,
> > >
> > > I'd like to make queries on my database, but this queries will depends
> on
> > > some arguments passed to the xml like this :
> > >     http://www.mysite.com/query.xml?ID=1&ID=3
> > >
> > > So If I have one argument I'll have one query looking like:
> > >     <esql:query>select * from my_table where id =
> 'argument'</esql:query>
> > >
> > > If I have 4 arguments I'll have 4 queries where 'argument' will be
> replaced
> > > by the value of each arguments.
> > > ...
> > >
> > > Does anybody knows a mean to generate the xml query file dynamically
> > > depending from the arguments and then to process these queries?
> > > How to get these arguments and process exactly the number of queries I
> need
> > > ...
> > >
> > >
> > > thank you for any help.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

Re: generate dynamically ?

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 10 Jan 2001, Matthew Cordes wrote:

> Did you remove the old esql entry from cocoon.properties?

yeah, damn, there's that to. robin, do you have any objections to
releasing 1.8.1?

- donald


Re: generate dynamically ?

Posted by Matthew Cordes <mc...@maine.edu>.
Did you remove the old esql entry from cocoon.properties?

-matt

On Wed, Jan 10, 2001 at 06:01:02PM +0100, Yann PETIT wrote:
> Perhaps I effectivelly don't use the right logicsheet .. but I've downloaded
> the cvs one (1.39)
> I put it in /cocoon/src/org/apache/cocoon/processor/xsp/library/sql/
> and I added  <?xml-logicsheet
> href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?> to
> my xml file
> 
> Did I forget anything ?
> 
> 
> 
> 
> ----- Original Message -----
> From: Donald Ball <ba...@webslingerZ.com>
> To: <co...@xml.apache.org>
> Sent: Wednesday, January 10, 2001 5:48 PM
> Subject: Re: generate <esql:excute-query> dynamically ?
> 
> 
> > On Wed, 10 Jan 2001, Yann PETIT wrote:
> >
> > > Thank you matt but ...
> > >
> > > I've already tried this solution  :o(
> > > But in fact the values[x] are not evaluated inside an esql taglib
> element !
> > >
> > > Any other ideas ?
> >
> > this should work. can you send me a message with the full xsp pages and
> > their generated java source code for the two examples you have below
> > attached, i'll see what's going on.
> >
> > can you tell me which version of the esql logicsheet you're using?
> >
> > - donald
> >
> > >
> ****************************************************************************
> > > **********************************
> > >
> ****************************************************************************
> > > **********************************
> > >
> > > If I do something like :
> > >
> > > <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
> 'T101'</esql:query>
> > >      <esql:results>
> > >       <result>
> > >        <Task_LIB>
> > >         <esql:get-string column="Task_LIB"/>
> > >        </Task_LIB>
> > >        <ID><xsp:expr>values[x]</xsp:expr></ID>
> > >       </result>
> > >      </esql:results>
> > >      <esql:no-results>
> > >
> > >
> > > I got the following errors ....
> > >
> > >
> > > java.lang.Exception: XSP Java Compiler: Compilation failed for
> > > _ultimetest.java
> > > 162: Undefined variable: values
> > >
> > >           xspExpr(values[x], document)
> > >
> > >                   ^
> > >
> > > 162: Undefined variable: x
> > >
> > >           xspExpr(values[x], document)
> > >
> > >                          ^
> > >
> > > 2 errors
> > >
> > >
> > >
> > >  at
> > >
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > > vaProcessor.java, Compiled Code)
> > >  at java.lang.Exception.(Exception.java, Compiled Code)
> > >  at
> > >
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > > vaProcessor.java, Compiled Code)
> > >  at
> org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> > > Compiled Code)
> > >  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
> > >  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> > >  at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> > > Compiled Code)
> > >  at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> > >  at
> > >
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > > (Ajp12ConnectionHandler.java, Compiled Code)
> > >  at
> > >
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> > > Compiled Code)
> > >  at java.lang.Thread.run(Thread.java, Compiled Code)
> > >
> ****************************************************************************
> > > **********************************
> > >
> ****************************************************************************
> > > **********************************
> > > And if I do something like
> > >
> > > <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
> > >
> <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter></esql:query>
> > >      <esql:results>
> > >       <result>
> > >        <Task_LIB>
> > >         <esql:get-string column="Task_LIB"/>
> > >        </Task_LIB>
> > >        </result>
> > >      </esql:results>
> > >      <esql:no-results>
> > >
> > >
> > > I got this error :
> > >
> > >
> > > java.lang.Exception: XSP Java Compiler: Compilation failed for
> > > _ultimetest.java
> > > 101: ')' expected.
> > >
> > >     xspParentNode = xspCurrentNode;
> > >
> > >                                   ^
> > >
> > > 1 error
> > >
> > >
> > >
> > >  at
> > >
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > > vaProcessor.java, Compiled Code)
> > >  at java.lang.Exception.(Exception.java, Compiled Code)
> > >  at
> > >
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > > vaProcessor.java, Compiled Code)
> > >  at
> org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> > > Compiled Code)
> > >  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
> > >  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> > >  at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> > > Compiled Code)
> > >  at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> > >  at
> > >
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > > (Ajp12ConnectionHandler.java, Compiled Code)
> > >  at
> > >
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> > > Compiled Code)
> > >  at java.lang.Thread.run(Thread.java, Compiled Code)
> > >
> > >
> ****************************************************************************
> > > **********************************
> > >
> ****************************************************************************
> > > **********************************
> > >
> > > yann
> > >
> > >
> > > ----- Original Message -----
> > > From: Matthew Cordes <mc...@maine.edu>
> > > To: <co...@xml.apache.org>
> > > Sent: Wednesday, January 10, 2001 4:12 PM
> > > Subject: Re: generate <esql:excute-query> dynamically ?
> > >
> > >
> > > > why not do:
> > > >
> > > >
> > > > <esql:connection>
> > > > <esql:pool>myPool</esql:pool>
> > > >
> > > > <xsp:logic>
> > > > String values[] = request.getParameterValues( "id" );
> > > >
> > > > for ( int x=0; x &lt; values.length; ++x )
> > > > {
> > > > <esql:execute-query>
> > > > <esql:query>
> > > > select * from my_table where id =
> > > > <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
> > > > </esql:query>
> > > >
> > > > <esql:results>
> > > > <!-- do stuff -->
> > > >
> > > > </esql:results>
> > > >
> > > > </esql:execute-query>
> > > > }
> > > > </xsp:logic>
> > > >
> > > > </esql:connection>
> > > >
> > > >
> > > > Is this basically what you're after?
> > > >
> > > > -matt
> > > >
> > > >
> > > >
> > > > On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> > > > > Hello everybody,
> > > > >
> > > > > I'd like to make queries on my database, but this queries will
> depends
> > > on
> > > > > some arguments passed to the xml like this :
> > > > >     http://www.mysite.com/query.xml?ID=1&ID=3
> > > > >
> > > > > So If I have one argument I'll have one query looking like:
> > > > >     <esql:query>select * from my_table where id =
> > > 'argument'</esql:query>
> > > > >
> > > > > If I have 4 arguments I'll have 4 queries where 'argument' will be
> > > replaced
> > > > > by the value of each arguments.
> > > > > ...
> > > > >
> > > > > Does anybody knows a mean to generate the xml query file dynamically
> > > > > depending from the arguments and then to process these queries?
> > > > > How to get these arguments and process exactly the number of queries
> I
> > > need
> > > > > ...
> > > > >
> > > > >
> > > > > thank you for any help.
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

Re: generate dynamically ?

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 10 Jan 2001, Yann PETIT wrote:

> Perhaps I effectivelly don't use the right logicsheet .. but I've downloaded
> the cvs one (1.39)
> I put it in /cocoon/src/org/apache/cocoon/processor/xsp/library/sql/
> and I added  <?xml-logicsheet
> href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?> to
> my xml file
>
> Did I forget anything ?

the resource:// url points to a location inside your classpath, probably
inside your cocoon.jar file. you either need to rebuild cocoon.jar (grab
the latest cvs, run the build script, ta-da) or else use a file:/// url in
your xml-logicsheet pi.

- donald


Re: generate dynamically ?

Posted by Yann PETIT <yp...@capgemini.fr>.
Perhaps I effectivelly don't use the right logicsheet .. but I've downloaded
the cvs one (1.39)
I put it in /cocoon/src/org/apache/cocoon/processor/xsp/library/sql/
and I added  <?xml-logicsheet
href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?> to
my xml file

Did I forget anything ?




----- Original Message -----
From: Donald Ball <ba...@webslingerZ.com>
To: <co...@xml.apache.org>
Sent: Wednesday, January 10, 2001 5:48 PM
Subject: Re: generate <esql:excute-query> dynamically ?


> On Wed, 10 Jan 2001, Yann PETIT wrote:
>
> > Thank you matt but ...
> >
> > I've already tried this solution  :o(
> > But in fact the values[x] are not evaluated inside an esql taglib
element !
> >
> > Any other ideas ?
>
> this should work. can you send me a message with the full xsp pages and
> their generated java source code for the two examples you have below
> attached, i'll see what's going on.
>
> can you tell me which version of the esql logicsheet you're using?
>
> - donald
>
> >
****************************************************************************
> > **********************************
> >
****************************************************************************
> > **********************************
> >
> > If I do something like :
> >
> > <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
'T101'</esql:query>
> >      <esql:results>
> >       <result>
> >        <Task_LIB>
> >         <esql:get-string column="Task_LIB"/>
> >        </Task_LIB>
> >        <ID><xsp:expr>values[x]</xsp:expr></ID>
> >       </result>
> >      </esql:results>
> >      <esql:no-results>
> >
> >
> > I got the following errors ....
> >
> >
> > java.lang.Exception: XSP Java Compiler: Compilation failed for
> > _ultimetest.java
> > 162: Undefined variable: values
> >
> >           xspExpr(values[x], document)
> >
> >                   ^
> >
> > 162: Undefined variable: x
> >
> >           xspExpr(values[x], document)
> >
> >                          ^
> >
> > 2 errors
> >
> >
> >
> >  at
> >
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > vaProcessor.java, Compiled Code)
> >  at java.lang.Exception.(Exception.java, Compiled Code)
> >  at
> >
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > vaProcessor.java, Compiled Code)
> >  at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> > Compiled Code)
> >  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
> >  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
> >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> >  at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> > Compiled Code)
> >  at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> >  at
> >
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (Ajp12ConnectionHandler.java, Compiled Code)
> >  at
> >
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> > Compiled Code)
> >  at java.lang.Thread.run(Thread.java, Compiled Code)
> >
****************************************************************************
> > **********************************
> >
****************************************************************************
> > **********************************
> > And if I do something like
> >
> > <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
> >
<esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter></esql:query>
> >      <esql:results>
> >       <result>
> >        <Task_LIB>
> >         <esql:get-string column="Task_LIB"/>
> >        </Task_LIB>
> >        </result>
> >      </esql:results>
> >      <esql:no-results>
> >
> >
> > I got this error :
> >
> >
> > java.lang.Exception: XSP Java Compiler: Compilation failed for
> > _ultimetest.java
> > 101: ')' expected.
> >
> >     xspParentNode = xspCurrentNode;
> >
> >                                   ^
> >
> > 1 error
> >
> >
> >
> >  at
> >
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > vaProcessor.java, Compiled Code)
> >  at java.lang.Exception.(Exception.java, Compiled Code)
> >  at
> >
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> > vaProcessor.java, Compiled Code)
> >  at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> > Compiled Code)
> >  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
> >  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
> >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> >  at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> > Compiled Code)
> >  at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> >  at
> >
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (Ajp12ConnectionHandler.java, Compiled Code)
> >  at
> >
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> > Compiled Code)
> >  at java.lang.Thread.run(Thread.java, Compiled Code)
> >
> >
****************************************************************************
> > **********************************
> >
****************************************************************************
> > **********************************
> >
> > yann
> >
> >
> > ----- Original Message -----
> > From: Matthew Cordes <mc...@maine.edu>
> > To: <co...@xml.apache.org>
> > Sent: Wednesday, January 10, 2001 4:12 PM
> > Subject: Re: generate <esql:excute-query> dynamically ?
> >
> >
> > > why not do:
> > >
> > >
> > > <esql:connection>
> > > <esql:pool>myPool</esql:pool>
> > >
> > > <xsp:logic>
> > > String values[] = request.getParameterValues( "id" );
> > >
> > > for ( int x=0; x &lt; values.length; ++x )
> > > {
> > > <esql:execute-query>
> > > <esql:query>
> > > select * from my_table where id =
> > > <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
> > > </esql:query>
> > >
> > > <esql:results>
> > > <!-- do stuff -->
> > >
> > > </esql:results>
> > >
> > > </esql:execute-query>
> > > }
> > > </xsp:logic>
> > >
> > > </esql:connection>
> > >
> > >
> > > Is this basically what you're after?
> > >
> > > -matt
> > >
> > >
> > >
> > > On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> > > > Hello everybody,
> > > >
> > > > I'd like to make queries on my database, but this queries will
depends
> > on
> > > > some arguments passed to the xml like this :
> > > >     http://www.mysite.com/query.xml?ID=1&ID=3
> > > >
> > > > So If I have one argument I'll have one query looking like:
> > > >     <esql:query>select * from my_table where id =
> > 'argument'</esql:query>
> > > >
> > > > If I have 4 arguments I'll have 4 queries where 'argument' will be
> > replaced
> > > > by the value of each arguments.
> > > > ...
> > > >
> > > > Does anybody knows a mean to generate the xml query file dynamically
> > > > depending from the arguments and then to process these queries?
> > > > How to get these arguments and process exactly the number of queries
I
> > need
> > > > ...
> > > >
> > > >
> > > > thank you for any help.
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: generate dynamically ?

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 10 Jan 2001, Yann PETIT wrote:

> Thank you matt but ...
>
> I've already tried this solution  :o(
> But in fact the values[x] are not evaluated inside an esql taglib element !
>
> Any other ideas ?

this should work. can you send me a message with the full xsp pages and
their generated java source code for the two examples you have below
attached, i'll see what's going on.

can you tell me which version of the esql logicsheet you're using?

- donald

> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
>
> If I do something like :
>
> <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID = 'T101'</esql:query>
>      <esql:results>
>       <result>
>        <Task_LIB>
>         <esql:get-string column="Task_LIB"/>
>        </Task_LIB>
>        <ID><xsp:expr>values[x]</xsp:expr></ID>
>       </result>
>      </esql:results>
>      <esql:no-results>
>
>
> I got the following errors ....
>
>
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _ultimetest.java
> 162: Undefined variable: values
>
>           xspExpr(values[x], document)
>
>                   ^
>
> 162: Undefined variable: x
>
>           xspExpr(values[x], document)
>
>                          ^
>
> 2 errors
>
>
>
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at java.lang.Exception.(Exception.java, Compiled Code)
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> Compiled Code)
>  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
>  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>  at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
>  at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
>  at java.lang.Thread.run(Thread.java, Compiled Code)
> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
> And if I do something like
>
> <esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
> <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter></esql:query>
>      <esql:results>
>       <result>
>        <Task_LIB>
>         <esql:get-string column="Task_LIB"/>
>        </Task_LIB>
>        </result>
>      </esql:results>
>      <esql:no-results>
>
>
> I got this error :
>
>
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _ultimetest.java
> 101: ')' expected.
>
>     xspParentNode = xspCurrentNode;
>
>                                   ^
>
> 1 error
>
>
>
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at java.lang.Exception.(Exception.java, Compiled Code)
>  at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
> vaProcessor.java, Compiled Code)
>  at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
> Compiled Code)
>  at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
>  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>  at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java, Compiled Code)
>  at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
>  at java.lang.Thread.run(Thread.java, Compiled Code)
>
> ****************************************************************************
> **********************************
> ****************************************************************************
> **********************************
>
> yann
>
>
> ----- Original Message -----
> From: Matthew Cordes <mc...@maine.edu>
> To: <co...@xml.apache.org>
> Sent: Wednesday, January 10, 2001 4:12 PM
> Subject: Re: generate <esql:excute-query> dynamically ?
>
>
> > why not do:
> >
> >
> > <esql:connection>
> > <esql:pool>myPool</esql:pool>
> >
> > <xsp:logic>
> > String values[] = request.getParameterValues( "id" );
> >
> > for ( int x=0; x &lt; values.length; ++x )
> > {
> > <esql:execute-query>
> > <esql:query>
> > select * from my_table where id =
> > <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
> > </esql:query>
> >
> > <esql:results>
> > <!-- do stuff -->
> >
> > </esql:results>
> >
> > </esql:execute-query>
> > }
> > </xsp:logic>
> >
> > </esql:connection>
> >
> >
> > Is this basically what you're after?
> >
> > -matt
> >
> >
> >
> > On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> > > Hello everybody,
> > >
> > > I'd like to make queries on my database, but this queries will depends
> on
> > > some arguments passed to the xml like this :
> > >     http://www.mysite.com/query.xml?ID=1&ID=3
> > >
> > > So If I have one argument I'll have one query looking like:
> > >     <esql:query>select * from my_table where id =
> 'argument'</esql:query>
> > >
> > > If I have 4 arguments I'll have 4 queries where 'argument' will be
> replaced
> > > by the value of each arguments.
> > > ...
> > >
> > > Does anybody knows a mean to generate the xml query file dynamically
> > > depending from the arguments and then to process these queries?
> > > How to get these arguments and process exactly the number of queries I
> need
> > > ...
> > >
> > >
> > > thank you for any help.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


Re: generate dynamically ?

Posted by Yann PETIT <yp...@capgemini.fr>.
Thank you matt but ...

I've already tried this solution  :o(
But in fact the values[x] are not evaluated inside an esql taglib element !

Any other ideas ?


****************************************************************************
**********************************
****************************************************************************
**********************************

If I do something like :

<esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID = 'T101'</esql:query>
     <esql:results>
      <result>
       <Task_LIB>
        <esql:get-string column="Task_LIB"/>
       </Task_LIB>
       <ID><xsp:expr>values[x]</xsp:expr></ID>
      </result>
     </esql:results>
     <esql:no-results>


I got the following errors ....


java.lang.Exception: XSP Java Compiler: Compilation failed for
_ultimetest.java
162: Undefined variable: values

          xspExpr(values[x], document)

                  ^

162: Undefined variable: x

          xspExpr(values[x], document)

                         ^

2 errors



 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at java.lang.Exception.(Exception.java, Compiled Code)
 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
Compiled Code)
 at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
 at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
 at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
 at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
 at java.lang.Thread.run(Thread.java, Compiled Code)
****************************************************************************
**********************************
****************************************************************************
**********************************
And if I do something like

<esql:query>SELECT Task_LIB FROM TASKS WHERE Task_ID =
<esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter></esql:query>
     <esql:results>
      <result>
       <Task_LIB>
        <esql:get-string column="Task_LIB"/>
       </Task_LIB>
       </result>
     </esql:results>
     <esql:no-results>


I got this error :


java.lang.Exception: XSP Java Compiler: Compilation failed for
_ultimetest.java
101: ')' expected.

    xspParentNode = xspCurrentNode;

                                  ^

1 error



 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at java.lang.Exception.(Exception.java, Compiled Code)
 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
Compiled Code)
 at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
 at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
 at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
 at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
 at java.lang.Thread.run(Thread.java, Compiled Code)

****************************************************************************
**********************************
****************************************************************************
**********************************

yann


----- Original Message -----
From: Matthew Cordes <mc...@maine.edu>
To: <co...@xml.apache.org>
Sent: Wednesday, January 10, 2001 4:12 PM
Subject: Re: generate <esql:excute-query> dynamically ?


> why not do:
>
>
> <esql:connection>
> <esql:pool>myPool</esql:pool>
>
> <xsp:logic>
> String values[] = request.getParameterValues( "id" );
>
> for ( int x=0; x &lt; values.length; ++x )
> {
> <esql:execute-query>
> <esql:query>
> select * from my_table where id =
> <esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
> </esql:query>
>
> <esql:results>
> <!-- do stuff -->
>
> </esql:results>
>
> </esql:execute-query>
> }
> </xsp:logic>
>
> </esql:connection>
>
>
> Is this basically what you're after?
>
> -matt
>
>
>
> On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> > Hello everybody,
> >
> > I'd like to make queries on my database, but this queries will depends
on
> > some arguments passed to the xml like this :
> >     http://www.mysite.com/query.xml?ID=1&ID=3
> >
> > So If I have one argument I'll have one query looking like:
> >     <esql:query>select * from my_table where id =
'argument'</esql:query>
> >
> > If I have 4 arguments I'll have 4 queries where 'argument' will be
replaced
> > by the value of each arguments.
> > ...
> >
> > Does anybody knows a mean to generate the xml query file dynamically
> > depending from the arguments and then to process these queries?
> > How to get these arguments and process exactly the number of queries I
need
> > ...
> >
> >
> > thank you for any help.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: generate dynamically ?

Posted by Matthew Cordes <mc...@maine.edu>.
why not do:


<esql:connection>
	<esql:pool>myPool</esql:pool>

	<xsp:logic>
		String values[] = request.getParameterValues( "id" );

		for ( int x=0; x &lt; values.length; ++x )
		{
			<esql:execute-query>
				<esql:query>
					select * from my_table where id = 
						<esql:parameter><xsp:expr>values[x]</xsp:expr></esql:parameter>
				</esql:query>

				<esql:results>
					<!-- do stuff -->

				</esql:results>

			</esql:execute-query>
		}
	</xsp:logic>	

</esql:connection>


Is this basically what you're after?

-matt



On Wed, Jan 10, 2001 at 01:53:20PM +0100, sPY wrote:
> Hello everybody,
> 
> I'd like to make queries on my database, but this queries will depends on
> some arguments passed to the xml like this :
>     http://www.mysite.com/query.xml?ID=1&ID=3
> 
> So If I have one argument I'll have one query looking like:
>     <esql:query>select * from my_table where id = 'argument'</esql:query>
> 
> If I have 4 arguments I'll have 4 queries where 'argument' will be replaced
> by the value of each arguments.
> ...
> 
> Does anybody knows a mean to generate the xml query file dynamically
> depending from the arguments and then to process these queries?
> How to get these arguments and process exactly the number of queries I need
> ...
> 
> 
> thank you for any help.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>