You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mohamed ramzy <m_...@yahoo.com> on 2000/05/31 15:11:13 UTC
SQL and XSP!!!!
hi
i want to make a dynamic query by useing XSP with SQL,
i did a simple Query but it didn't work ..which is
<xsp:logic>
String[] tst=request.getParametersValues("type");
</xsp:logic>
<query connection="first">
select * from pet
where species= "<xsp:expr>tst[0]</xsp:expr>"
</query>
where "type" holds the name of a species.....
it didn't work///
does anyone has an idea!!!!!
Thanx in Advance
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
Re: SQL and XSP!!!!
Posted by Rafael Oropeza <ro...@eud.com>.
Just try to printout the value of tst[0]. Maybe it comes null...
mohamed ramzy wrote:
> hi
> i want to make a dynamic query by useing XSP with SQL,
> i did a simple Query but it didn't work ..which is
>
> <xsp:logic>
> String[] tst=request.getParametersValues("type");
> </xsp:logic>
> <query connection="first">
> select * from pet
> where species= "<xsp:expr>tst[0]</xsp:expr>"
> </query>
>
> where "type" holds the name of a species.....
> it didn't work///
>
> does anyone has an idea!!!!!
>
> Thanx in Advance
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
--
Rafael Alberto Oropeza Baudet
(53) Character is the foundation to accomplishment--if you have
diligence and determination, you'll succeed
Beverly Chiodo
Re: SQL and XSP!!!!
Posted by Nishit Trivedi <ni...@planet.net>.
Instead what you can do is:
--------------------------------------------------------------------
<xsp:logic>
String[] tst=request.getParametersValues("type");
String query = "";
query = "select * from pet where species= '" + tst[0] + "';
</xsp:logic>
<query connection="first">
<xsp:expr>query</xsp:expr>
</query>
--------------------------------------------------------------------
Note exact location of single and double quotes when you insert xsp
variable..
tst[0] is surrounded by + sign which is surrounded by pair of double quotes
which is surrounded by pair of single quotes..
Nishit
Internet Programmer
Planet Access Networks
973-691-4704 Ext:157
----- Original Message -----
From: "mohamed ramzy" <m_...@yahoo.com>
To: "Cocoon list" <co...@xml.apache.org>
Sent: Wednesday, May 31, 2000 9:11 AM
Subject: SQL and XSP!!!!
> hi
> i want to make a dynamic query by useing XSP with SQL,
> i did a simple Query but it didn't work ..which is
>
>
> <xsp:logic>
> String[] tst=request.getParametersValues("type");
> </xsp:logic>
> <query connection="first">
> select * from pet
> where species= "<xsp:expr>tst[0]</xsp:expr>"
> </query>
>
> where "type" holds the name of a species.....
> it didn't work///
>
> does anyone has an idea!!!!!
>
> Thanx in Advance
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
Re: SQL and XSP!!!!
Posted by "Wm. G. Urquhart" <wi...@devnet-uk.net>.
mohamed ramzy wrote:
>
> hi
> i want to make a dynamic query by useing XSP with SQL,
> i did a simple Query but it didn't work ..which is
>
> <xsp:logic>
> String[] tst=request.getParametersValues("type");
> </xsp:logic>
> <query connection="first">
> select * from pet
> where species= "<xsp:expr>tst[0]</xsp:expr>"
> </query>
>
> where "type" holds the name of a species.....
> it didn't work///
>
> does anyone has an idea!!!!!
>
> Thanx in Advance
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Use:
String tst = request.getParameter("type") ;
...
select * from pet where species= '<xsp:expr>tst</xsp:expr>'
...
William.
Re: SQL and XSP!!!!
Posted by Donald Ball <ba...@webslingerZ.com>.
Strongly suggest you look into using the XSP SQL Taglib:
http://xml.apache.org/cocoon/sqltaglib.html
- donald
On Wed, 31 May 2000, mohamed ramzy wrote:
> hi
> i want to make a dynamic query by useing XSP with SQL,
> i did a simple Query but it didn't work ..which is
>
>
> <xsp:logic>
> String[] tst=request.getParametersValues("type");
> </xsp:logic>
> <query connection="first">
> select * from pet
> where species= "<xsp:expr>tst[0]</xsp:expr>"
> </query>
>
> where "type" holds the name of a species.....
> it didn't work///
>
> does anyone has an idea!!!!!
>
> Thanx in Advance
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>