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自帶標簽 s:selectedItems
2.將后臺的列表設置為靜態。
附:標簽說明
<s:selectItems>
Creates a List<SelectItem>
from a List, Set, DataModel or Array.
-
value
— an EL expression specifying the data that backs theList<SelectItem>
-
var
— defines the name of the local variable that holds the current object during iteration -
label
— the label to be used when rendering theSelectItem
. Can reference thevar
variable. -
disabled
— if true theSelectItem
will be rendered disabled. Can reference thevar
variable. -
hideNoSelectionLabel
— if true, thenoSelectionLabel
will be hidden when a value is selected
<h:selectOneMenu value="#{person.age}"
converter="ageConverter">
<s:selectItems value="#{ages}" var="age" label="#{age}" />
</h:selectOneMenu>