users@glassfish.java.net

Re: Visual Web JSF, nested drop down list

From: <glassfish_at_javadesktop.org>
Date: Mon, 04 May 2009 13:23:29 PDT

Hi,

I have got make it works. The next step is append a RowKey in the final Table that depends on the selected item of the second combo. I use the standard method but it does not work.

What I am trying to do is append rows to insert data in the database. But when I click on the button that makes the work it does not make the work. It take to an existing row from another DDLs selection. This selection is the default that appears when I load the jsp.

This is the code I am meaning,

public String btnAddProducto_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        if (productoDataProvider.canAppendRow()){
            try {
                RowKey rk = productoDataProvider.appendRow();
                productoDataProvider.setCursorRow(rk);

                productoDataProvider.setValue("PRODUCTO.ID_PRODUCTO", new Integer(0));
                productoDataProvider.setValue("SUBCATEGORIA.ID_SUBCATEGORIA", subcategoriasDD.getSelected());
                productoDataProvider.setValue("CATEGORIA.ID_CATEGORIA", categoriasDD.getSelected());
            } catch (Exception ex) {
                log("Error Description", ex);
                error("Error: " + ex.getMessage());
            }
        } else {
            log("Cannot append new producto");
            error("Cannot append new producto");
        }
        return null;
    }

This productoDataProvider is related with a productoRowSet that represents a query that, in my opinion, it needs to be a relation with all the tables in my simple database. I mean: PRODUCTO, SUBCATEGORIA_PRODUCTO, SUBCATEGORIA, CATEGORIA_SUBCATEGORIA and CATEGORIA.

This is because I select a CATEGORIA that take me to the corresponding SUBCATEGORIA that at the end must load the Table component with PRODUCTO.

But if I want to insert a new PRODUCTO from the empty Table component, I cannot append the correct empty row (RowKey)

Any idea?

Thanks in advance,
Jose Alvarez de Lara
[Message sent by forum member 'josealvarezdelara' (josealvarezdelara)]

http://forums.java.net/jive/thread.jspa?messageID=344927