使用<f:selectItems value="#{itemTypeList}" />實現(xiàn)下拉列表時,報錯:
Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(typeFilter). Found org.jboss.seam.jsf.ListDataModel.
其中itemTypeList是action中定義的一個Datamodal。
錯誤原因,f:selectItems引用的是一個static的List,還不能是ArrayList,
解決方法:
1.使用seam自帶標(biāo)簽 s:selectedItems
2.將后臺的列表設(shè)置為靜態(tài)。
附:標(biāo)簽說明
Description
Creates a List<SelectItem>
from a List, Set, DataModel or Array.
Attributes
Usage
<h:selectOneMenu value="#{person.age}"
converter="ageConverter">
<s:selectItems value="#{ages}" var="age" label="#{age}" />
</h:selectOneMenu>