cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: generate <esql:excute-query> dynamically ?
Date Wed, 10 Jan 2001 16:48:49 GMT
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 <mcorde61@maine.edu>
> To: <cocoon-users@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
>
>


Mime
View raw message