A much better approach to this problem is simply to use JSON. A number of comments below are in regard to nested lists. The solution detailed here does not readily facilitate nested lists. The solution outlined in this blog does: http://outbottle.com/spring-4-web-mvc-json-handling/. JSON is the recommended way of achieving “Adding Objects to a List element on the fly”
Alternatively, this blog also demonstrates the solution:
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.
ok, hard to describe this one and hard to find stuff on google so here’s an image explaining.
I had this desperately annoying problem where I had two Combobox components. Using the .CascadeTo functionality, I was able to have the second Combobox load data via an AJAX call based on the selection in the first Combobox. This is standard functionality detailed in the demo site here.
The problem was that if the AJAX call to load the second comboxbox with data returned no elements, the Combobox remained disabled. This was unintuitive for the user and made it look like the UI had frozen.
Add an ‘OnDataBound’ event handler to the Combobox then from this…
…. count the number of elements in the Combobox and do something to notify the user if there are no elements
This tutorial demonstrates how to handle exceptions in Spring 3 Web MCV.
A Netbeans project is available for download at the bottom of this page.
This tutorial on “Integrating Hibernate with Spring 3 Web MVC” incorporates:
Hibernate Transaction Control
@RequestMapping friendly URL’s. More on this specific Spring 3 Web MVC friendly URL topic here. (Alternative @RequestParam method here)
A Generic DAO suitable for Hibernate operations with Spring 3 Web MVC. More here in this separate Generic DAO tutorial.
Spring 3 Web MVC Dependency Injection (DI) and Inversion of Control (IoC). More on DI and IoC here.
Netbeans (7.1.1 used here but any version will do)
The complete Netbeans project is available for download here. The SQL for the project is included in the download in the WEB-INF folder.
Update: Jan 8, 2014
The project originally available for download does not work with Netbeans 8 due to libraries that were in Netbeans 7.1.1 no longer available in Netbeans 8. Additionally, a comment below referencing Netbeans 7.0 .1 may suggest the same problem. This enforces the point that a dependency management utility is a much better means of building projects. To that end this project has been recreated using Maven. This ensures it will work irrespective of IDE version. In fact because it’s a maven project it’s not dependant on an IDE at all. It should work on any IDE that supports Maven. Netbeans of course, does support Maven. Here is the download link SpringHibernateCrudMvn for the Maven version of this application.
The POM is quite comprehensive in that it includes support for Spring, Spring-Security, Jackson, Hibernate, Hibernate-search and a bunch of other utilities. It can serve as a template to a certain extent.