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
Book: Cocoon Developer's Handbook (SAMS)
Yves Vindevogel wrote:
Hi,
I've got a form with one textbox (name) and a combobox (type)
When the user presses "submit", a searchpage is called where I execute this query (on postgres db)
<esql:query>
select * from vwProducts
where upper(name) like upper('%<xsp-request:get-parameter name="name"/>%')
and typeoid = <xsp-request:get-parameter name="type"/>
</esql:query>
This works ....
Unfortunately, the combobox must be filled out. That's not exactly what I want because the user may let this one empty (selecting all with a certain name without regard to the type)
In that case, my query should be (empty combobox)
select * from vwProducts where upper(name) like upper('%<xsp-request:get-parameter name="name"/>%')
Something like this works too:
<esql:query>
<xsp:logic>
"select * from vwProducts where typeoid = " + <xsp-request:get-parameter name="type"/>
</xsp:logic>
</esql:query>
If I try this, I get errors : (Starts when I use an if-clause)
<esql:query>
<xsp:logic>
if (<xsp-request:get-parameter name="type"/>.equals("0"))
{
"select * from vwProducts"
}
else
{
"select * from vwProducts where name like ('%product%')"
} ;
<xsp:logic>
</esql:query>
I've tried several methods, I get:
Illegal start of expression on line ..... Method ValueOf() missing ....
Anyone can help me out ??
--------------------------------------------------------------------- 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]>