2010-10-28 65 views

回答

4

創建包含這些行

public class FooList { 
    private List<Foo> foos;  
    ... 
} 

,並使用它作爲命令對象的窗體對象。要將行綁定到表單域,請使用索引路徑:

<form:form modelAttribute = "fooList" ...> 
    <ul> 
    <c:forEach items = "${fooList.foos}" varStatus = "s"> 
     <li><form:input path = "foos[${s.index}].name" /></li> 
    </c:forEach> 
    </ul> 
</form:form> 
相關問題