0
我想有一个列表,每一个记录/行的表格单元格中的下拉列表JSTL形式:选择在表格单元格中C:的forEach
customerList保持连接实体(与customerGroup和assignedVendor属性)
vendorList持有供应商实体(有姓名和CustomerID属性
这是我到目前为止有:
<form:form action="${pageContext.request.contextPath}/vendorAdmin/viewClients/${vendorGroupID}" method="post" >
<table class="table table-striped table-bordered table-hover " id="sample_1">
<thead>
<tr class="bg-success">
<th>Admin Name</th>
<th>Email</th>
<th>Username</th>
<th>Phone</th>
<th>Assign To</th>
<th></th>
</tr>
</thead>
<c:forEach items="${customerList}" var="connection" varStatus="cStatus">
<tr>
<td>${customerList[cStatus.index].customerGroup.name}</td>
<td class="text-center">${customerList[cStatus.index].customerGroup.customerList[0].email}</td>
<td class="text-center">${customerList[cStatus.index].customerGroup.customerList[0].username}</td>
<td class="text-center">${customerList[cStatus.index].customerGroup.customerList[0].phone}</td>
<td>
<form:select path="customerList[${cStatus.index}].assignedVendor.customerID">
<form:options items="${vendorList}" itemLabel="name" itemValue="customerID"/>
</form:select>
</td>
<td>
<a href="<spring:url value="/vendorAdmin/sendMessageToCustomer/${vendorGroupID}/${customerList[cStatus.index].customerGroup.userGroupID}" />"
><span class="glyphicon glyphicon-message "></span></a>
</td>
</tr>
</c:forEach>
</table>
</form:form>
错误:
ERROR o.s.web.servlet.tags.form.SelectTag - Neither BindingResult nor plain target object for bean name 'command' available as request attribute
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:144)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:116)
at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422)
at org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:194)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
有人能指出我要去的地方错了吗?
编辑:我的不是足够清晰的道歉。问题不在于我无法从控制器获取customerList。一切正常,除了form:select
这感觉就像我在path
中犯了一个错误,无法访问该字段。希望这使它更清楚一点
这是不可能没有的代码。 –