Hi,
I have done something like this before and i suggest that you should
include an id when posting to SFC. In this way, you can guarantee that
your dao will update the database with the correct id. Don't rely on the
index of the list as the command object is not stored in the session. It
is fetched from the db again when you post the form and so the data may
not be the same. Please correct me if I am wrong.
Best regards,
Jonathan
Jong Hian Zin wrote:
This is rather Spring MVC specific. Let say I'm using
SimpleFormController and I have a command object that looks like this:
public class ItemsForm {
List<Item> items;
}
A domain object Item:
public class Item {
private String id;
private String description;
// getters and setters...
}
Suppose my command name is "form", the rendered view may look like
this (by formBackingObject()):
<form>
<input type="text" name="form.items[0].description" value="...">
<input type="text" name="form.items[1].description" value="...">
<input type="text" name="form.items[2].description" value="...">
...
</form>
So, my question is, do we need to include the id as hidden fields like
form.items[0].id, etc in the form? How does Spring MVC know how to
bind each item in the list of items during onSubmit? Is it by the
index of the array or is it by the id?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]