Hi,

try to wrap it in a xsp:logic block:

...
         <esql:execute-query>
                <esql:row-results>
                        <xsp:logic>
                        got_uname = <esql:get-string column="id"/>;
                        </xsp:logic>
             </esql:row-results>
         </esql:execute-query>
...

Max

> -----Ursprüngliche Nachricht-----
> Von: Chris Newland [mailto:[EMAIL PROTECTED]]
> Gesendet: Montag, 20. August 2001 13:21
> An: Cocoon-Users
> Betreff: Possible to assign SQL query result to XSP variable?
>
>
> Hi All,
>
> I'm trying to test for the presence of a key in an SQL table
> by performing
> an SQL query and having the result (or null) set in an XSP variable:
>
> <para>checking for username = <xsp:expr>username</xsp:expr></para>
>
> String got_uname = "dummy";
>
>   <esql:connection>
>         <esql:pool>my_jdbc</esql:pool>
>         <esql:execute-query>
>                 <esql:query>
>                   select id from enduser where enduser.id =
> <esql:parameter><xsp:expr>username</xsp:expr></esql:parameter>
>                 </esql:query>
>               <esql:row-results>
>                       got_uname = <esql:get-string column="id"/>;
>             </esql:row-results>
>         </esql:execute-query>
>   </esql:connection>
>
> <para>got value from db uname = <xsp:expr>got_uname</xsp:expr></para>
>
> where 'id' is the primary key column in the enduser table.
>
> Is this even a rational thing to try and do?
>
> When the page executes, the value for got_uname is "dummy"
> and the Java code
> created from the page does not attempt to assign the
> got_uname variable to
> the SQL result.
>
> Can somebody let me know if it is actually
> possible/reasonable to try and
> assign XSP variables from SQL queries?
>
> Thanks for your help,
>
> Chris
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to