cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: SQLProcessor and WML problem
Date Fri, 31 Mar 2000 17:51:58 GMT
On Fri, 31 Mar 2000, Carlos Vinueza M. wrote:

> Hi, guys
> Im designing an application with WML and MySQL.
> Cocoon and SQLProcessor work really cool, but now I have a stupid
> problem that Im not able to solve yet...
> The thing is that the user has to type a value (an ID number) in the
> first card, and then in the next one with that value I will have to
> build my select to show the result, but the thing is that Im really
> confused in how to build the code with the xsl and the xml files to get
> the number.
> 
> This is what I have now:
> 
> 
> -----the xml file-----
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <?cocoon-process type="sql"?>
> <?xml-stylesheet href="http://xx.xx.xx.xx/wap/res2.xsl"
> type="text/xsl"?>
> <?cocoon-process type="xslt"?>
> <page>
>  <connectiondefs>
>   <connection name="www_odbc">
>    <driver>org.gjt.mm.mysql.Driver</driver>
>    <dburl>jdbc:mysql://xx.xx.xx.xx/myDB</dburl>
>   </connection>
>  </connectiondefs>
>  <query connection="www_odbc">
>   select icc from icc_search where id='1712907870'  //HERES THE NUMBER
> THAT I HAVE TO GET FROM THE USER
>  </query>
> </page>

Might I suggest that you switch to the xsp sql taglib instead of the sql
processor? not all functionality is there yet, but it's quite simple to do
what you're asking:

<?xml version="1.0"?>
<?cocoon-process type="sql"?>
<?xml-stylesheet href="..."?>
<?cocoon-process type="xslt"?>
<xsp:page
 xmlns:xsp="http://www.apache.org/1999/XSP/Core"
 xmlns:request="http://www.apache.org/1999/XSP/Request"
 xmlns:sql="http://www.apache.org/1999/SQL"
>
 <page>
  <sql:execute-query>
   <sql:driver>org.gjt.mm.mysql.Driver</sql:driver>
   <sql:dburl>jdbc:mysql://xx.xx.xx.xx/myDB</dburl>
   <sql:query>select icc from icc_search where id = &apos;<request:get-parameter
name="id"/>&apos;</sql:query>
  </sql:execute-query>
 </page>
</xsp:page>

Note I've never played with WML before, so I don't know that information
submitted from a WML form ends up in an HttpServletRequest or not - I
reckon so, but if not, then you must put in special java code (or write a
utility class and a namespace taglib) to get the parameter in place of the
request:get-parameter element.

Oh, final note, you must be using cocoon from CVS or whatever stefano just
released for this to work - i had some trouble making text and elements
mixed together work properly until ricardo straightened me out.

- donald


Mime
View raw message