Hi!

I have a table called "clientsproducts" with 3 keys:

cli_id          Client
pro_id  (Product)
cat_id  (Category)

In this example, the pro_id and cat_id are a complex key from the table 
"products", because every product has a category. And one category can have 
many products.

When I need to create a relation between a client and his products. I need to 
know the category of this product. If the cli_id is fixed, then I need to 
make the following behavior:

A) If the user selectec a productm then I need to select the category in the 
combobox
B) If the user selects a category, I need to refresh the combo of products, to 
show only the products of this category.

As you can see I have two combos.

As far as I go is:

<xsp:logic>
String a = "SELECT cat_id, cat_name FROM categories ";

if ("Refresh".equals(<xsp-request:get-parameter name="cocoon-action-Refresh" 
as="string"/>))
 {
   int i = Integer.parseInt(<xsp-request:get-parameter name="cat_id" 
default="0"/>);

   if (i > 0)
   {
     a.concat("WHERE cat_id=");
     a.concat(Integer.toString(i));
   }
   } -->
</xsp:logic>
<td><select name="cat_id">

 <esql:execute-query>
 <esql:query>
  <xsp:expr>a</xsp:expr>
 </esql:query>
</select>
......

The problem is that I cannot make the query a right query.

I got

SELECT cat_id, cat_name FROM categories 

or

"SELECT cat_id, cat_name FROM categories WHERE cat_id ="

Can someone help me?

Regards,

Antonio Gallardo.





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

Reply via email to