在集合集合中绑定对象

在集合集合中绑定对象

本文介绍了在集合集合中绑定对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个填充一些集合的对象的表单。我收集了一个列表(一切都很好),但现在我想使用一个集合。我有一个注册的属性编辑器来创建对象。问题是我不知道我必须使用什么语法来填充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

解决方案

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.

这篇关于在集合集合中绑定对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 05:04