You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeff Jones <JA...@weather.com> on 2004/07/29 23:20:47 UTC
Re: [esql] xsp:logic doesn't work inside ?
Christina,
I can't explain why that doesn't work, but I've never tried it. You could do it
this way, though:
<esql:query>
SELECT foo FROM bar
WHERE baz = <esql:parameter><xsp:expr>( (test) ? "quux" : blort.someMethod()
)</xsp:expr></esql:parameter>
</esql:query>
In other words, replace the "if (test)" statement with the equivalent "(test) ?
expr1 : expr2" expression. <xsp:expr> should work here, even though <xsp:logic>
doesn't.
</Jeff>
"Christina"
<lechaelnah@hotma To: <us...@cocoon.apache.org>
il.com> cc:
Subject: [esql] xsp:logic doesn't work inside <esql:query>?
07/29/2004 07:33
PM
Please respond to
users
I tried to use if () inside <esql:query> like this:
....
<esql:query>
<xsp:logic>
if (true) {
<esql:parameter>...</esql:parameter>
}
</xsp:logic>
</esql:query>
....
but every time there is error message on this "if", it is ok if I delete
everything before and after the nested <xsp:logic> tag.
So <xsp:logic> cannot work inside of <esql:query>? or I did something wrong?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [esql] xsp:logic doesn't work inside ?
Posted by Christina <le...@hotmail.com>.
Brent,
what if there is some special character inside the string, for example
some " or ',
if I just wrap them up as a string, error might happens during the query,
you know mysql might throw an error if your query is
select user_id from users where user_name="""""";
----- Original Message -----
From: "Brent Johnson" <bl...@gmail.com>
To: <us...@cocoon.apache.org>
Sent: Thursday, July 29, 2004 8:18 PM
Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
> Yes - try running your loop outside the esql tags (as I suggested
> before). Build your SQL statement as a String then just do:
>
> <esql:query><xsp:expr>mySqlStatement</xsp:expr></esql:query>
>
> Just a suggestion.
>
> - Brent
>
> On Thu, 29 Jul 2004 21:03:04 -0700, Christina <le...@hotmail.com>
wrote:
> > Hi, Jeff,
> > that is a good idea. But what if I have another "for" loop inside of
the
> > "if"?
> > What I really want to do is take a list from the request attribute
and
> > query every entry in that list.
> > also i don't know the length of the list beforehand. so I need an
"if"
> > for the first entry (encase that is a list with zero length) and a "for"
> > loop for every one else.
> > Any idea how to do it?
> > Thanks!
> >
> >
> > ----- Original Message -----
> > From: "Jeff Jones" <JA...@weather.com>
> > To: <us...@cocoon.apache.org>
> > Sent: Thursday, July 29, 2004 2:20 PM
> > Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
> >
> > >
> > > Christina,
> > >
> > > I can't explain why that doesn't work, but I've never tried it. You
could
> > do it
> > > this way, though:
> > >
> > > <esql:query>
> > > SELECT foo FROM bar
> > > WHERE baz = <esql:parameter><xsp:expr>( (test) ? "quux" :
> > blort.someMethod()
> > > )</xsp:expr></esql:parameter>
> > > </esql:query>
> > >
> > > In other words, replace the "if (test)" statement with the equivalent
> > "(test) ?
> > > expr1 : expr2" expression. <xsp:expr> should work here, even though
> > <xsp:logic>
> > > doesn't.
> > >
> > > </Jeff>
> > >
> > >
> > >
> > >
> > > "Christina"
> > > <lechaelnah@hotma To:
> > <us...@cocoon.apache.org>
> > > il.com> cc:
> > > Subject: [esql]
xsp:logic
> > doesn't work inside <esql:query>?
> > > 07/29/2004 07:33
> > > PM
> > > Please respond to
> > > users
> > >
> > >
> > >
> > >
> > >
> > >
> > > I tried to use if () inside <esql:query> like this:
> > > ....
> > > <esql:query>
> > > <xsp:logic>
> > > if (true) {
> > > <esql:parameter>...</esql:parameter>
> > > }
> > > </xsp:logic>
> > > </esql:query>
> > > ....
> > > but every time there is error message on this "if", it is ok if I
delete
> > > everything before and after the nested <xsp:logic> tag.
> > > So <xsp:logic> cannot work inside of <esql:query>? or I did something
> > wrong?
> > > Thanks!
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [esql] xsp:logic doesn't work inside ?
Posted by Brent Johnson <bl...@gmail.com>.
Yes - try running your loop outside the esql tags (as I suggested
before). Build your SQL statement as a String then just do:
<esql:query><xsp:expr>mySqlStatement</xsp:expr></esql:query>
Just a suggestion.
- Brent
On Thu, 29 Jul 2004 21:03:04 -0700, Christina <le...@hotmail.com> wrote:
> Hi, Jeff,
> that is a good idea. But what if I have another "for" loop inside of the
> "if"?
> What I really want to do is take a list from the request attribute and
> query every entry in that list.
> also i don't know the length of the list beforehand. so I need an "if"
> for the first entry (encase that is a list with zero length) and a "for"
> loop for every one else.
> Any idea how to do it?
> Thanks!
>
>
> ----- Original Message -----
> From: "Jeff Jones" <JA...@weather.com>
> To: <us...@cocoon.apache.org>
> Sent: Thursday, July 29, 2004 2:20 PM
> Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
>
> >
> > Christina,
> >
> > I can't explain why that doesn't work, but I've never tried it. You could
> do it
> > this way, though:
> >
> > <esql:query>
> > SELECT foo FROM bar
> > WHERE baz = <esql:parameter><xsp:expr>( (test) ? "quux" :
> blort.someMethod()
> > )</xsp:expr></esql:parameter>
> > </esql:query>
> >
> > In other words, replace the "if (test)" statement with the equivalent
> "(test) ?
> > expr1 : expr2" expression. <xsp:expr> should work here, even though
> <xsp:logic>
> > doesn't.
> >
> > </Jeff>
> >
> >
> >
> >
> > "Christina"
> > <lechaelnah@hotma To:
> <us...@cocoon.apache.org>
> > il.com> cc:
> > Subject: [esql] xsp:logic
> doesn't work inside <esql:query>?
> > 07/29/2004 07:33
> > PM
> > Please respond to
> > users
> >
> >
> >
> >
> >
> >
> > I tried to use if () inside <esql:query> like this:
> > ....
> > <esql:query>
> > <xsp:logic>
> > if (true) {
> > <esql:parameter>...</esql:parameter>
> > }
> > </xsp:logic>
> > </esql:query>
> > ....
> > but every time there is error message on this "if", it is ok if I delete
> > everything before and after the nested <xsp:logic> tag.
> > So <xsp:logic> cannot work inside of <esql:query>? or I did something
> wrong?
> > Thanks!
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [esql] xsp:logic doesn't work inside ?
Posted by Christina <le...@hotmail.com>.
Hi, Jeff,
that is a good idea. But what if I have another "for" loop inside of the
"if"?
What I really want to do is take a list from the request attribute and
query every entry in that list.
also i don't know the length of the list beforehand. so I need an "if"
for the first entry (encase that is a list with zero length) and a "for"
loop for every one else.
Any idea how to do it?
Thanks!
----- Original Message -----
From: "Jeff Jones" <JA...@weather.com>
To: <us...@cocoon.apache.org>
Sent: Thursday, July 29, 2004 2:20 PM
Subject: Re: [esql] xsp:logic doesn't work inside <esql:query>?
>
> Christina,
>
> I can't explain why that doesn't work, but I've never tried it. You could
do it
> this way, though:
>
> <esql:query>
> SELECT foo FROM bar
> WHERE baz = <esql:parameter><xsp:expr>( (test) ? "quux" :
blort.someMethod()
> )</xsp:expr></esql:parameter>
> </esql:query>
>
> In other words, replace the "if (test)" statement with the equivalent
"(test) ?
> expr1 : expr2" expression. <xsp:expr> should work here, even though
<xsp:logic>
> doesn't.
>
> </Jeff>
>
>
>
>
> "Christina"
> <lechaelnah@hotma To:
<us...@cocoon.apache.org>
> il.com> cc:
> Subject: [esql] xsp:logic
doesn't work inside <esql:query>?
> 07/29/2004 07:33
> PM
> Please respond to
> users
>
>
>
>
>
>
> I tried to use if () inside <esql:query> like this:
> ....
> <esql:query>
> <xsp:logic>
> if (true) {
> <esql:parameter>...</esql:parameter>
> }
> </xsp:logic>
> </esql:query>
> ....
> but every time there is error message on this "if", it is ok if I delete
> everything before and after the nested <xsp:logic> tag.
> So <xsp:logic> cannot work inside of <esql:query>? or I did something
wrong?
> Thanks!
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org