Re: Dynamic query in xsp:logic and esql:query (partly solved)

2003-01-05 Thread Yves Vindevogel
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:poolpierrefabre/esql:pool

esql:execute-query
xsp:logic
String myQuery = select * from vwProducts ;
/xsp:logic
esql:query
xsp:exprmyQuery/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:poolpierrefabre/esql:pool

esql:execute-query
esql:query
xsp:exprmyQuery/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:exprmyQuery/xsp:expr
 /esql:query

 I do this all the time and it works perfectly.

 Regards,

 Lajos

-- 
Kind regards,
Yves Vindevogel

Implements
Kortrijkstraat 2 bus 1  --  9700 Oudenaarde  --  Belgium
Phone/Fax: +32 (55) 45.74.73  --  Mobile: +32 (478) 80.82.91
Mail: [EMAIL PROTECTED]  --  www.implements.be

Quote: The winner never says participating is more important than winning.

-
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]




Re: Dynamic query in xsp:logic and esql:query (partly solved)

2003-01-05 Thread Lajos Moczar
I can't understand what you are doing w/out seeing the whole XSP. 
Typically I do this:

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:poolpierrefabre/esql:pool

   esql:execute-query
 esql:queryxsp:exprmyQuery/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:poolpierrefabre/esql:pool

esql:execute-query
	xsp:logic
	String myQuery = select * from vwProducts ;
/xsp:logic
			esql:query
	xsp:exprmyQuery/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:poolpierrefabre/esql:pool

esql:execute-query
			esql:query
	xsp:exprmyQuery/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:exprmyQuery/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]