Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
274 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...