I'm creating a dynamic form and was hoping to avoid some domain specificity.
I'm wondering if it is possible to bind the first element of a List<String> that is a value in a Map to a textarea.
Example Command Object:
Example JSP (assume 'key' exists in the map with a not null list as a value):Code:public class FormObject(){ private Map<Integer, List<String>> formMap = new HashMap<Integer, List<String>>(); public FormObject public Map<Integer, List<String>> getformMap(){ return this.formMap; } public void setFormMap(Map<Integer, List<String>> formMap){ this.formMap = formMap; } }
I've also tried the following but I don't even know if its legal:Code:<form:form modelAttribute="formObject"> <form:textarea path="formMap[key]" /> </form:form>
In the past I know I've bound a textarea to the specific elements in a list:Code:<form:form modelAttribute="formObject"> <form:textarea path="formMap[key][0]" /> </form:form>
I can bind the map value to <form:radiobuttons> and <form:checkboxes> without any issue.Code:<form:form modelAttribute="someFormObject"> <form:textarea path="someList[0]" /> </form:form>
Any advice would be appreciated and I am happy to clarify if this doesn't make sense.
Thanks!


Reply With Quote
