The project downloadable below is an answer to a question repeated in this blog (Spring 3 MVC – Adding Objects to a List element on the fly at form submit – (Generic method))
“How can I submit nested lists of objects?”
The answer is AJAX and JSON.
A very good approach to this is with AngularJS and Spring as demonstrated here.
When the page loads it makes an AJAX call to the server to fetch the model.
The model is bound on the page using AngularJS.
The controls (buttons and input fields) on the page allow the model to be edited.
The model can then be sent to the server via AJAX where it can be persisted. The updated model is returned to the client where it is again bound using angularJS.
The application looks like this
This is a Maven project so just navigate to it using your IDE, open it and run it.