cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhi <sudheen...@insage.com>
Subject Re: Dynamic sql Query
Date Tue, 29 Aug 2000 21:47:53 GMT
Hi,
try moving ur xsp:login inside page, and inside xsp logic u can use
request.getParameter() directly.

HTH
Sudhi

Matthew Cordes wrote:
> 
> Hello all.
> 
> I'm having a bit of trouble understanding how xsp and java interact.
> I have a sql query that i wish to augment based upon request parameters.
> Here is an example:
> 
> <?xml version="1.0"?>
> 
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet href="page.xsl" type="text/xsl"?>
> 
> <xsp:page
>         language="java"
>         xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>         xmlns:sql="I can't recall the sql namespace, but its correct in my code"
>         xmlns:request="http://www.apache.org/1999/XSP/Request"
> >
> 
> <xsp:logic>
>         String name = String.valueOf( <request:get-parameter name="name"/> );
>         String age = String.valueOf( <request:get-parameter name="age"/> );
>         String where = "";
> 
>         if ( name != null &amp;&amp; !name.equals(""))
>                 where = " name is not null";
> 
>         else if ( age != null &amp;&amp; !name.equals(""))
>                 where = " age is not null";
> </xsp:logic>
> 
> 
> <page>
>         <!-- i left out the driver, etc for brevity -->
>         <sql:execute-query>
>                 <sql:query>
>                         select name, age, occupation, etc from sometable
>                         where <xsp:expr>where</xsp:expr>
>                 <sql:query>
>         </sql:query>
> </page>
> 
> </xsp:page>
> 
> This is an oversimplified example, but you see what I'm trying to do.
> I want to construct a java string and then pass it to the sqltaglib.
> 
> The problem is I'm told 'request' is undefined upon compilation
> of the xsp:logic block above. The 'where' is also undefined in the
> sql:execute-query block.
> 
> Any ideas?
> 
> -matt
> 
> ---------------------------------------------------------------------
> 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