Oct 11th, 2012, 04:51 AM
Display complex object in JSP containing multiple collections to capture user inputs
I need help in the correct approach to follow for a particular scenario using Spring MVC -
From the service I get a Collection<Category> type. Now each category has fields like id, name, description and also a Collection<Products> available for that category.
Now I have to show a user registration form, where apart from the user fields (like Name, email, etc..), I have to present these various Category objects and the user has the option to select a category and also can select a product out of the listed products for that category. So, I need to show a checkbox against the category name and then a combo box for displaying the products.
How can I capture this in the command object passed to JSP. I have created a commad as UserForm where in apart from the user fields, I have a Collection<Category> also in that. I can iterate through that in JSP, but how to capture the user selections for the category and the product chosen for that category?
Please provide your suggestions.