绑定 Set 集合中的对象
我有一个表格,其中填充了集合的一些对象。我用列表实现了集合(一切正常),但现在我想使用集合。我注册了一个属性编辑器来创建对象。问题是我不知道必须使用什么语法来填充 Set 的对象。
public class MyObject(){
Set<OtherObject> otherObjects = new HashSet();
}
我尝试过使用表单标签中的语法,例如列表的语法:
name="otherObjects['${status.index}']"
和映射的语法:
name="otherObjects['${id}']"
但是两者都会出错,因为“索引属性路径'otherObjects[0]'中引用的属性既不是数组也不是列表或地图”
我也尝试过,
name="otherObjects"
但这并没有填充对象。 谁能告诉我如何将数据绑定到 Set 中的对象。
谢谢
I have a form which fills some objects of a Collection. I had the collection implemented with a List (an everything worked good), but now I want to use a Set. I have a property editor registered to create the objects. The problem is that I don't know what is the syntax I must use to populate the objects of the Set.
public class MyObject(){
Set<OtherObject> otherObjects = new HashSet();
}
I have tried with the syntax in the form tags, like the syntax a list:
name="otherObjects['${status.index}']"
and like the syntax for a map:
name="otherObjects['${id}']"
but both come to an error because "Property referenced in indexed property path 'otherObjects[0]' is neither an array nor a List nor a Map"
I have also tried with
name="otherObjects"
but this doesn't fill the objects.
Can anyone tell me how to bind the data to the objects in a Set.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据数据绑定文档,您只能使用方括号表示法来绑定到“自然排序集合”中的嵌套对象。一套不合格。
According to the documentation on data binding, you can only user the bracket notation to bind to nested objects in a "naturally ordered collection". A set doesn't qualify.
不能在表单标签中使用旧语法并添加一个将返回一组对象的 getter 吗?
Can't you use the old syntax in the form tags and add a getter that will return a set of objects?