我正在使用 JSF 标记 h:selectOneMenu 作为下拉列表。
<h:selectOneMenu id="subscriberName" value="#{manageSubscriberInformation.subscriberName}"
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{manageSubscriberInformation.subList}" />
</h:selectOneMenu>
subList 对象是我在我的 bean 类中使用 getter 和 setter 定义的列表。在我的 servlet 的 init 方法中,我用一些值填充列表。但是当我加载页面时,我收到以下错误:
java.lang.IllegalArgumentException: Collection referenced by UISelectItems with binding '#{manageSubscriberInformation.subList}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/manageSubscriber.jsp][Class: javax.faces.component.UINamingContainer,Id: body][Class: javax.faces.component.html.HtmlForm,Id: c][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: subscriberName][Class: javax.faces.component.UISelectItems,Id: _idJsp143]} does not contain Objects of type SelectItem
无法理解导致问题的原因。