Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pre-populate an object to update not using DrivenModel aproach

 
Tony Manello
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic