Hi, I would like to use the same <esql:results> block for currently three different queries that return the same fields but use distinct conditions and parameters. I tried to use a <xsp:logic> block for choosing the <esql:query> but I only get an error message. Is this kind of logic possible with XSP/logicsheets?
Tom
--
T h o m a s Z e h e t b a u e r ( TZ251 )
PGP encrypted mail preferred - KeyID 96FFCB89
finger [EMAIL PROTECTED] for key
Experience is what you get when you expected something else.
<?xml version="1.0" encoding="UTF-8"?> <xsp:page language="java" xmlns:esql="http://apache.org/cocoon/SQL/v2" xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:xsp="http://apache.org/xsp"> <page> <title>German/English Dictionary</title> <stylesheet>css/Dictionary.css</stylesheet> <content> <form> <table class="query"> <tr class="query"> <td class="queryCaption">Query</td> <td class="queryValue"><input class="queryValue" name="query"/></td> </tr> <tr class="direction"> <td class="directionCaption">Direction</td> <td class="directionValue"> <select class="directionValue" name="direction"> <option value="BOTH">both</option> <option value="ENGLISH">German -> English</option> <option value="GERMAN">English -> German</option> </select> </td> </tr> <tr class="submit"> <td class="submit" colspan="2"><input class="submit" type="submit" value="Go!"/></td> </tr> </table> </form> <xsp:logic> String query = <xsp-request:get-parameter name="query"/>; String direction = <xsp-request:get-parameter name="direction"/>; if (query != null && direction != null) { <esql:connection> <esql:pool>Dictionary</esql:pool> <esql:execute-query> <xsp:logic> if ("ENGLISH".equals(direction)) { <esql:query>SELECT English,German FROM GermanEnglish WHERE German REGEXP <esql:parameter><xsp:expr>query</xsp:expr></esql:parameter> ORDER BY English</esql:query> } else if ("GERMAN".equals(direction)) { <esql:query>SELECT English,German FROM GermanEnglish WHERE English REGEXP <esql:parameter><xsp:expr>query</xsp:expr></esql:parameter> ORDER BY English</esql:query> } else { <esql:query>SELECT English,German FROM GermanEnglish WHERE English REGEXP <esql:parameter><xsp:expr>query</xsp:expr></esql:parameter> OR German REGEXP <esql:parameter><xsp:expr>query</xsp:expr></esql:parameter> ORDER BY English</esql:query> } </xsp:logic> <esql:results> <table class="result"> <tr class="resultHeader"> <td class="resultHeaderEnglish">English</td> <td class="resultHeaderGerman">German</td> </tr> <esql:row-results> <tr class="result"> <td class="resultEnglish"><esql:get-string column="English"/></td> <td class="resultGerman"><esql:get-string column="German"/></td> </tr> </esql:row-results> </table> </esql:results> </esql:execute-query> </esql:connection> } </xsp:logic> </content> </page> </xsp:page>
signature.asc
Description: This is a digitally signed message part
