Spring 4 Web MVC with AngularJS

Introduction

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

adding_elements_to_nested_list_angularJS_style

Download

This is a Maven project so just navigate to it using your IDE, open it and run it.

Spring4JSONAddingElementToNestedList

 

 

 

  • Paul

    How can I run this project? Which server do I need ?

    • Hi Paul

      You can simply open the project with Netbeans and hit run. It will select the server automatically or you will be prompted to select an application server from a list of installed/associated servers. Any issues, please feel free to ask further questions here.

      John

  • Sergio Vivar

    Muchas gracias, me ayudó muchísimo