Spring mvc Spring MVC接口绑定集合
我尝试将接口列表绑定到控制器,并能够以JSP形式编辑它们。 我创建了如下列表:Spring mvc Spring MVC接口绑定集合,spring-mvc,Spring Mvc,我尝试将接口列表绑定到控制器,并能够以JSP形式编辑它们。 我创建了如下列表: private List<MyInterface> list = new AutoPopulatingList<MyInterface>(MyInterface.class); private List=new AutoPopulatingList(MyInterface.class); 我可以填充列表并将其发送到JSP,在JSP上我使用spring表单标记,如下所示: <c:for
private List<MyInterface> list = new AutoPopulatingList<MyInterface>(MyInterface.class);
private List=new AutoPopulatingList(MyInterface.class);
我可以填充列表并将其发送到JSP,在JSP上我使用spring表单标记,如下所示:
<c:forEach items="${list}" var="entry" varStatus="i">
<form:input path="list[${i.index]" />
</c:forEach>
到目前为止一切都很好,我的问题是当我提交表格。
我的列表中的每个元素都可以是接口的不同实现,接口确实公开了类型属性
我想要一种方法,在创建列表中元素的实例时告诉Spring,以查看适当的类型字段并创建正确的实现