| Author |
How to pre-populate an object to update not using DrivenModel aproach
|
Tony Manello
Greenhorn
Joined: Aug 11, 2010
Posts: 13
|
|
Hi I've been stuck with this question since two days. I got and object and i would like to update it. I'm using the object as javabean property aproach instead of using DrivenModel, so I got one action that shows all the objects and the user can choose one to update (passing the id using a hidden field from the form). Next I got an action that populate the form with the object using prepare(). Finally I got the last action that updates that object. My problem is that I can't populate the form with object data, form appears with blank properties.
Snippets:
struts.xml
Where "Editar" means "Edit", "Listar" means "List" and "Modificar" means "Update"
Here it is "ListarNotas.jsp"
Action "EditarNota"
"EditarNota.jsp"
And finally Action "ModificarNota"
Any suggestion or tip? What am I doing wrong?
|
 |
Tony Manello
Greenhorn
Joined: Aug 11, 2010
Posts: 13
|
|
The problem is that the form is not prepoluted, I've tried using <s:hidden> inside the form but it is not working.
The secuence I follow is:
1 - From a jps with a list of objects I use a <s:form action=edit.Action> with a hidden field which contains the object's id to update.
2 - An edit form with "prepopulated data" inside <s:form action=updateAction> with a hidden field with the id. (This action retrieves the object using id inside execute() method and returns SUCCESS.
I get blank fields in the edit form.
I don't know what I'm doing wrong.
Any suggestion?
|
 |
Tony Manello
Greenhorn
Joined: Aug 11, 2010
Posts: 13
|
|
Hi,
I solved the problem it was my fault I forgot to declare the object I want to prepopulate, and finally I Used ModelDriven and it works ok!
|
 |
 |
|
|
subject: How to pre-populate an object to update not using DrivenModel aproach
|
|
|