I have custom Question objects which I render into html form elements. I want to be able to dynamically create these objects and generate a dynamic html form from them. The question object has a String property to hold the result from the form. How can I get this to work in Spring?
The way I have it working (which doesn't seem ideal), is I have a bean to back the custom form. This bean has two properties: a List to hold the questions to be displayed and a List to hold the results. The JSP has a tag which tells it to use the bean as a model attribute. Then I have a custom JSP tag that takes the List and renders them into form elements. The elements are given IDs of answer[n] and Spring will put the results of the form into the List property in the backing bean.
Does anyone know how I can do this better?