我正在努力让我的 JSP 中更改的列表值返回到 MVC 控制器。这些值显示得很好,但是在提交表单时更改不会显示在 ModelAttribute 中(任何更改的非列表值都会在提交时显示)。以下是相关代码的缩略版:
JSP:
<c:forEach items="${poForm.poDetail}" varStatus="i">
...
<!-- Product Description -->
<td class="leftAlign" >
<form:input path="poDetail[${i.index}].description" />
</td>
支持表格:
public class POForm {
private List<PurchaseOrderDetail> poDetail;
...
}
采购订单详情:
public class PurchaseOrderDetail implements Comparable<PurchaseOrderDetail>{
private String partNumber; // alpha-numeric part number (vendor's)
private String description; // Product name/description
... remaining properties are non-complex
}
控制器:
@RequestMapping(value="/savePO",method=RequestMethod.POST)
public ModelAndView savePO(@ModelAttribute("poForm") POForm poForm, final
HttpServletRequest request) {
.... "examine the poForm here and items of poDetail are unchanged"
}
有什么建议可以尝试吗??