Hi Phil,

I have the same kind of action to perform, I do it by including the sendmail
section inside the esql:row-results. Maybe there're other ways to do it, but
here's a snippet that works for me :


<esql:connection>
     <esql:pool>dvdadmin</esql:pool>
     <esql:execute-query>
      <esql:query>SELECT *  FROM users WHERE
email='<xsp-request:get-parameter name="email"/>'</esql:query>
      <esql:results>
       <table>
        <esql:row-results>

         <xsp:logic>
 String smtphost = <util:get-sitemap-parameter name="smtphost"/> ;
 String msg ="Voici votre login : \n";
 String userId = <esql:get-string column="user_id"/>;
 String pass = <esql:get-string column="pass"/>;
 String email = <esql:get-string column="email"/>;
 String msg2 ="\n Voici votre password : \n";
            </xsp:logic>
         <mail:send-mail>
          <mail:charset>ISO-8859-1</mail:charset>
          <mail:smtphost><xsp:expr>smtphost</xsp:expr></mail:smtphost>
          <mail:from>[EMAIL PROTECTED]</mail:from>
          <mail:to><xsp:expr>email</xsp:expr></mail:to>
          <mail:subject>Votre profil DVD à la carte</mail:subject>

<mail:body><xsp:expr>msg</xsp:expr><xsp:expr>userId</xsp:expr><xsp:expr>msg2
</xsp:expr><xsp:expr>pass</xsp:expr></mail:body>
         </mail:send-mail>
        </esql:row-results>
       </table>
      </esql:results>
      <esql:no-results>
       <p class="titre-2">Cette adresse n'est pas enregistrée.</p>
      </esql:no-results>
     </esql:execute-query>
    </esql:connection>


HTH,
Julien

----- Original Message ----- 
From: "Philippe Guillard" <[EMAIL PROTECTED]>
To: "users cocoon" <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 9:21 AM
Subject: ESQL result pushed in sendmail in same XSP page?


> Hi all,
> I make the serverpage generator treat ESQL and sendmail in the same
> .xsp, and i'd like to pass the parameter i get from my ESQL statement in
> the sendmail generation.
>
> Question :
> - I'd like to know if this is possible?
> - If not, what solution could avoid this situation
> (XSP Action for ESQL  before sendmail generation?)
>
> Regards,
>
> Phil
>
> My Sample : below i get the user's password first with ESQL then
> sendmail it to the user, here the error is "yourpassword cannot be
> resolved":
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsp:page language="java"
>           xmlns:xsp="http://apache.org/xsp";
>           xmlns:xsp-request="http://apache.org/xsp/request/2.0";
>           xmlns:esql="http://apache.org/cocoon/SQL/v2";
>
> xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0";>
> <page>
>   <title>title</title>
>    <esql:connection>
>      <esql:pool>mypool</esql:pool>
>        <esql:execute-query>,
>          <esql:query>select password from USER where
> email=<esql:parameter><xsp-request:get-parameter
> name="email"/></esql:parameter></esql:query>
>          <esql:results>
>               <esql:row-results>
>                   <xsp:logic>
>                      String yourpassword = new String(<esql:get-string
> column="password"/>);
>                   </xsp:logic>
>               </esql:row-results>
>           </esql:results>
>           <esql:no-results>
>           </esql:no-results>
>        </esql:execute-query>
>    </esql:connection>
>    <sendmail:send-mail>
>       <sendmail:smtphost>localhost</sendmail:smtphost>
>       <sendmail:from>[EMAIL PROTECTED]</sendmail:from>
>       <sendmail:to><xsp-request:get-parameter
> name="email"/></sendmail:to>
>       <sendmail:subject><xsp:expr>subject</xsp:expr></sendmail:subject>
>
> <sendmail:body><xsp:expr>yourpassword</xsp:expr></sendmail:body>
>    </sendmail:send-mail>
> </page>
> </xsp:page>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to