cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Sinjiashvili <sl...@swes.sarenergo.ru>
Subject Re: IF - ELSE expression into an XSP with ESQL
Date Wed, 15 Oct 2003 07:37:12 GMT
Josep Riudavets Aguilo wrote:
> Hi all ...
[ skipped ]
> If "solicitat" is true, no more database access are allowed, and the
> XSP must ignore the second query.
> 
> How can I implement this IF-ELSE expression? I know about
> <xsp:logic> taglib for implementing java code, but I don't know if
> ESQL taglibs can be placed into <xsp:logic> taglib.
Yes, you certainly can use <xsp:logic> with esql,
here's how your XSP might look like:

<esql:execute-query>
   <esql:query>SELECT solicitat FROM expedients WHERE
          nom='<xsp:expr>nom</xsp:expr>' AND
          cognoms='<xsp:expr>cognoms</xsp:expr>' AND
          dni='<xsp:expr>dni</xsp:expr>';
   </esql:query>
   <esql:results>
     <esql:row-results>
       <xsp:logic>boolean soli = <esql:get-boolean column="solicitat"/>;
         if (soli) {
       </xsp:logic>
         <esql:execute-query>
           <esql:query>SELECT mail FROM expedients WHERE
               nom='<xsp:expr>nom</xsp:expr>' AND
               cognoms='<xsp:expr>cognoms</xsp:expr>' AND
               dni='<xsp:expr>dni</xsp:expr>';
           </esql:query>
           <esql:results>
             <esql:row-results>
                ...
             </esql:row-results>
           </esql:results>
         </esql:execute-query>  
       <xsp:logic>}</xsp:logic>        
     </esql:row-results>
   </esql:results>
</esql:execute-query>

Hope that helps,
-- Ed


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message