2

I have the following 2 objects :

public class Form {
    private Long id;
    private String name;
    private ArrayList<FormField> fields;
...
}

public class FormField {
    private Long id;
    private String name;
...
}

Is it possible to receive the whole data in

public Result add(@ModelAttribute Form form)

?

The logical thing I thought of was sending the parameters in the following way

id:1
name:testdf
fields.id:1
fields.id:2
fields.id:3
fields.id:
fields.name:field 1
fields.name:field 2
fields.name:field3

But this doesn't seem to be working, Any idea how to handle a request like this ?

I'm trying to avoid custom renderers or manually parsing the HTTPRequest to fill my object.

Thanks

Dany Y
  • 6,833
  • 6
  • 46
  • 83
  • What about serializing it as JSON? That would probably mean posting through javascript instead of through a form. – mugua Mar 31 '16 at 23:23
  • It's a good idea, but in my case i'll have to manually construct the object to loop over the elements and add them to the json object. – Dany Y Apr 06 '16 at 08:52

0 Answers0