我收到錯誤:從XHTML文件javax.faces.FacesException:價值必須是一個數組或一個集合
javax.faces.FacesException: Value of 'frmrapport:type' must be an array or a collection
:
<p:selectManyMenu id="type" required="true"
value="#{userReporting.getTypeParId(userReporting.selected)[0].nomType}">
<f:selectItem itemLabel="co" itemValue="co" />
<f:selectItem itemLabel="pi" itemValue="pi" />
<f:selectItem itemLabel="si" itemValue="si" />
</p:selectManyMenu>
從Java bean的
:
public List getTypeParId(int id){
return this.genTypeFacade.getTypeParId(id);
}
問題是豆是List
,我無法將列表轉換爲String[]
。
如果問題是「如何將列表轉換爲字符串[]」,則它是重複的**和**,非常容易在Internet和SO上查找。但我相信這不是你真正的問題。 –
Nathan