<xsp:page language="Java" ... />
<html> <!-- This is your "root user tag" -->
<xsp:logic>
String myQuery = "select * from vwProducts";
<!-- Or whatever logic you need to build the query string -->
</xsp:logic>
<!-- other tags, as appropriate -->
<esql:connection>
<esql:pool>pierrefabre</esql:pool>
<esql:execute-query>
<esql:query><xsp:expr>myQuery</xsp:expr></esql:query>
<!-- rest of esql tags go here -->
</esql:execute-query>
</esql:connection>
</html>
Lajos
Yves Vindevogel wrote:
Hi,
I had tried this:
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true">
<html>
<esql:connection>
<esql:pool>pierrefabre</esql:pool>
<esql:execute-query>
<xsp:logic>
String myQuery = "select * from vwProducts" ;
</xsp:logic>
<esql:query>
<xsp:expr>myQuery</xsp:expr>
</esql:query>
And this didn't work !! I says: variable myQuery not found in class ..... When I do this, it works :
Guess the first part of the problem already got me on the wrong way ....
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true">
<xsp:logic>
String myQuery = "select * from vwProducts" ;
</xsp:logic>
<html>
<esql:connection>
<esql:pool>pierrefabre</esql:pool>
<esql:execute-query>
<esql:query>
<xsp:expr>myQuery</xsp:expr>
</esql:query>
NOW:
When I do this:
<xsp:logic>
String myQuery;
myQuery = "select * from vwProducts" ;
</xsp:logic>
It still gives me "class myQuery not found in class ....."
It only works when I immediatly assign it (String s = "jkml";)
I can't do anything on the string afterwards ...
How is that possible ??
Yves - Why not build your select statement as a string variable inside an <xsp:logic> block after the root user tag, and then reference it thusly:<esql:query> <xsp:expr>myQuery</xsp:expr> </esql:query> I do this all the time and it works perfectly. Regards, Lajos
-- galatea.com Cocoon training, consulting & support --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>