• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Visual Web JSF, nested drop down list

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am making a web app using NetBeans 6.5 VWJSF framwork. My database has three tables
CATEGORIA, SUBCATEGORIA and PRODUCTO with a ManyToMany relationship. So I have made
two more tables CATEGORIA_SUBCATEGORIA and SUBCATEGORIA_PRODUCTO. Now the relationship
is ManyToOne - OneToMany.

The application has three JSP Categoria.jsp, Subcategoria.jsp and Producto.jsp.

Everything is ok, but in Producto.jsp I am using two nested Drop Down List. I select the categoria, and this
load the subcategoria DDL with the related data from the SUBCATEGORIA database table. This work fine. But
when I select the subcategoria I am using a Table component to load the related producto. And at this point
my app fails. And I do not know what I am doing wrong.

It is simple. In Subcategoria. jsp I am using a DDL categoria to load a Table component with the data of
SUBCATEGORIA database table related with the selected categoria.

This is my code for the nested DDLs,






Now what I am doing is first append rows in the Table component to add data
and at the end save de provided data, The code,



This is the method that does not work

Please help,

Thanks in advance,
Jose Alvarez de Lara
 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

I have got wrong.

This post must to be in Java Server Faces thread

Excuse me. Will you move it to its thread?

Regards,
Jose Alvarez de Lara
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Done.
 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have solved my issue. Just passing a flag on the request to the prerender method:

- if the flag says "nothing" I can change the DDLs selection
- if the flag says "addrows" or "saverows" I make it by keeping the current DDLs selection

Thanks a lot,
Jose Alvarez de Lara
 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Going on with my web over NetBeans 6.5 Visual Web JSF, I had to make some changes to my data model because an initial wrong design. But I want to talk about Piezas.java.

In Piezas.java I have three DDLs (Categorias, Subcategorias and Productos), three buttons (“New Pieza”, “Save Pieza”, and “Return to Index”) and a UIComponent Table that represents the selected Piezas.

The relationships between database tables is as follow,


Categoria
PK: ID_CATEGORIA

Subcategoria
PK: ID_SUBCATEGORIA
FK: ID_CATEGORIA

Producto
PK: ID_PRODUCTO
FK: ID_CATEGORIA
FK: ID_SUBCATEGORIA

Pieza
PK: ID_PIEZA
FK: ID_PRODUCTO



So my Piezas.java try CRUD based on this relationship. The DDLs Categorias and Subcategorias are set in a Virtual Form to set the DDL Productos. This works fine.
And when I select some categoria or subcategoria that take me to a producto´s non value, the UIComponent Table Pieza looks empty: ok.

I have three Virtual Forms, “categoria_subcategoria” to nest with the DDL Productos, “saveproducto” that save the new nested values on the DDL Productos on Participate and Submit the new pieza, and “save” to load the corresponding values on the UIComponent Table Pieza once selected a new producto.

What is my problem? When I try to add a new pieza, in the UIComponent Table Pieza appears the first row in the database table Pieza. I mean, there are two cases, there is no Producto and I cannot append any row, or there is a producto so when I append a new row it has to be from the entity of the selected Producto. Well, it is not. It is always from the entity of the first row of the database table Pieza.

This is my code,






It was taking me two weeks and I have any idea about the solution.
Please help.

Best regards,
Jose Alvarez de Lara
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic