修改每個訂單一個點的工作表單到每個訂單多個點我遇到了預填充問題h:selectOneMenu。例外的是java.lang.IllegalArgumentException: Value binding '#{spot.deliveryTypes}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /order.jsp][Class: javax.faces.component.html.HtmlForm,Id: pf][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _idJsp11][Class: javax.faces.component.UISelectItems,Id: _idJsp12]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
如何預先填充重複h:selectOneMenu?
舊工作JSP代碼:
<h:selectOneMenu value="#{order.deliveryType}" immediate="true">
<f:selectItems value="#{order.deliveryTypes}" />
</h:selectOneMenu>
新工作不JSP代碼:
<c:forEach var="spot" items="${order.spots}">
<h:selectOneMenu value="#{spot.deliveryType}" immediate="true">
<f:selectItems value="#{spot.deliveryTypes}" /> <%-- Works as empty list if this line removed --%>
</h:selectOneMenu> <c:out value="${spot.name}"/><br/>
</c:forEach>
新領域引入List<Spot> spots
以及getter和setter。已將List<SelectItem> getDeliveryTypes()
從託管bean類Order移動到Spot類。
如何訪問spot.deliveryTypes?將#改爲$並沒有幫助,因爲value =不接受EL。
MyFaces 1.1.8
謝謝。