I have a specific use case where a domain entity contains a few properties that contain multiple values. More specifically I need to have an enter form where an unlimited number of phone numbers can be attached to a person.
I imagine this use case it pretty common - as another example would be multiple attachments on a e-mail form.
Putting the phone number on a view by itself is possible but not what the client has requested.
Code:public class Person{ private String name; private List<String> phoneNumbers; //getter/setter for name public List<String> getPhoneNumbers(){ return this.phoneNumbers; } public void addPhoneNumber(String phoneNumber){ this.phoneNumbers.add(phoneNumber); } }HTML Code:<form:form commandName="person"> <form:input path="name" /> <input name="phoneNumber" type="text" value="" /> <input type="button" value="Attach Phone Number" /> <c:forEach items="${person.phoneNumbers}" var="phoneNumber"> <c:out value="${phoneNumber}" /> </c:forEach> <input type="submit" value="Next" /> </form:form>


Reply With Quote