I don't know to much with < s: ...> tags, but I know how to do in usually jsp 
pages.
I created one page with form where I add new car, or what ever, this form's 
action is activated one servlet which will add new car in list, this servlet at 
the end will dispatched to some jsp page you want.
I so curious so please tell me how hyou solve this problem!
 
Regards,
Biljana

--- On Fri, 6/5/09, fjtorres <kisco1...@gmail.com> wrote:


From: fjtorres <kisco1...@gmail.com>
Subject: [java ee programming] Struts 2 - Indexed properties
To: "Java EE (J2EE) Programming with Passion!" 
<java-ee-j2ee-programming-with-passion@googlegroups.com>
Date: Friday, June 5, 2009, 1:25 AM



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