Grails/Spring对象的数据绑定映射
我在绑定到具有对象映射的命令对象时遇到问题。这是我的命令对象:Grails/Spring对象的数据绑定映射,spring,grails,data-binding,Spring,Grails,Data Binding,我在绑定到具有对象映射的命令对象时遇到问题。这是我的命令对象: class SaveEntries { Map<Integer, EntryRow> entryRows = new HashMap<Integer, EntryRow>() String name } class EntryRow { int systemID def hours = ["","","","","","",""] } 这是我的表格: <form ac
class SaveEntries {
Map<Integer, EntryRow> entryRows = new HashMap<Integer, EntryRow>()
String name
}
class EntryRow {
int systemID
def hours = ["","","","","","",""]
}
这是我的表格:
<form action="main/save">
<input type="text" name="name" value="test"/>
<input type="text" name="entryRows[0].systemID" value="1"/>
<input type="text" name="entryRows[0].hours[0]" value="5"/>
<input type="submit"/>
</form>
如您所见,entryRows映射没有填充任何内容。如果我使用name=“entryRows['test']value=“test”,我可以得到一个要填充的映射,但是一旦我尝试使用一个对象作为键,数据绑定就会失败
有人知道我哪里出错了吗?谢谢!您使用的是哪个版本的grails?我使用的是2.3.6版
<form action="main/save">
<input type="text" name="name" value="test"/>
<input type="text" name="entryRows[0].systemID" value="1"/>
<input type="text" name="entryRows[0].hours[0]" value="5"/>
<input type="submit"/>
</form>
[entryRows[0].systemID:[1], name:[test], entryRows[0].hours[0]:[5]]
[entryRows[0].systemID:1, entryRows[0]:[systemID:1, hours[0]:5], name:test, entryRows[0].hours[0]:5, action:save, format:null, controller:main]
test