Hi all,

I will let you know a little problem

I have one application with Struts 2, Spring 2.5 and Hibernate.

In one of screens have the detail of a client and relation their Cars.
My thought was that when you press the add button will add a new line
in the list of cars. This line be in edit mode to enter the data of
new car.

I need that when information is sent is stored in my client object
(client.setCars()). The client.cars is java.util.Set. I can save the
objects that already exist, but not the new objects.

My code:

1 - Action:

public class ClienteCRUDAction extends ActionSupport implements
Preparable {

....
private ClienteBO clienteBO;

private Cliente cliente;

private Set<Coche> coches;

...

public String save () {
  this.cliente.setCoches(this.coches);
  this.clienteBO.save(this.cliente);
  return SUCCESS;
}

....

}

2 - ClienteCRUDAction-conversion.properties:

KeyProperty_coches=id
Element_coches=es.facturacion.model.Coche
CreateIfNull_coches=true
//Esto es lo que me gustaria, pero no funciona
#KeyProperty_cliente.coches=id
#Element_cliente.coches=es.facturacion.model.Coche
#CreateIfNull_cliente.coches=true

3 - JSP:
.....
<s:iterator status="state" value="cliente.coches">
      <s:hidden name="coches(%{id}).matricula" value="%{matricula}"/>
      <s:hidden name="coches(%{id}).modelo" value="%{modelo}"/>
     <s:hidden name="coches(%{id}).marca" value="%{marca}"/>
     <s:hidden name="coches(%{id}).anno" value="%{anno}"/>
     <s:hidden name="coches(%{id}).cliente.id" value="%{cliente.id}"/>
    .....
</s:iterator>
......

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to