In my view, i have to collect demographics of the customer.Based on a 'yes''no' condition i have to display a address section, which has a button for adding address.So,when the user clicks on that "ADD Address", I have to display the same section again; which contains all the required information to be displayed to the user.So, this button has to generate this section on 'ON-CLICK' and remove when "Clicked remove". My question is how can you bind data with Spring MVC 3 for these on fly creations and removal.I can't do hide and show div operations, as the user can select 'n' address.
Asked
Active
Viewed 442 times
1 Answers
0
Don't quite visualize the problem, but "I can't do hide and show div operations" cuts a lot of options out because this is really a case for jquery, or javascript, etc in my opinion, passing in the full model and populating the bits you need (you did tag this with jquery?).
If you are stuck using server-side, then options include:
- Having different views and going to a second form with addresses if they choose the Y condition to show the address.
- Use objects in your model such as lists and arrays that can allow you to bind to n objects and send them back to the controller e.g. List. See How to bind a list of object to SpringMvc Controller? or Spring 3 MVC - Advanced Data Binding - Form Request with List of Simple Objects
-
I guess,I have to use AutopopulatList which comes with Spring 3.I can find how the controllers are defined but unable to see full view (Jquery) implementation. – user874722 Jul 26 '12 at 00:35
-
I am using this as a reference http://uxt.ucsd.edu/uxtuistack/guides/form/collections.html – user874722 Jul 26 '12 at 00:41