2

How I can bind a collection to a form for inputdata (not for show)

mathyas
  • 21
  • 1
  • 2

2 Answers2

2

e.g. for a Set<Jokers>

protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(
        Set.class,
        "[nameOfTheClassMemberItShouldGoto]",
        new CustomCollectionEditor(Set.class) {
            protected Object convertElement(Object element) {
                return (element == null ? null : getQueryService().getJoker(element.toString()));
            }
        }
    );
}

or similar to this

jitter
  • 53,475
  • 11
  • 111
  • 124
0

I did the same question and got a nice solution, take a look here How to bind a list of object to SpringMvc Controller?

Community
  • 1
  • 1
goenning
  • 6,514
  • 1
  • 35
  • 42