2017-06-16 17 views
-2

我的錯誤:javax.el.PropertyNotWritableException非法語法設定操作

javax.el.PropertyNotWritableException: /rapport.xhtml @295,93 value="# 
{userReporting.getNameType(userReporting.selected)}": Illegal Syntax 
for Set Operation 

我XHTML:

<p:selectManyMenu id="type" value="#{userReporting.getNameType(userReporting.selected)}"> 
    <f:selectItem itemLabel="do" itemValue="do" /> 
    <f:selectItem itemLabel="ro" itemValue="ro" /> 
    <f:selectItem itemLabel="go" itemValue="go" /> 
</p:selectManyMenu> 

我的豆:

public String[] getNameType(int id){ 
    String[] strings = (String[]) this.genTypeFacade.getNameType(id).stream().toArray(String[]::new); 
    return strings; 
} 

我不能提交表單

+0

請閱讀此答案:https://stackoverflow.com/a/2090062/1144326 –

回答

0

值屬性不應該有g etter方法的值,因爲它也將用於設置選定的值。使用類似value =「#{userRepoeting.selectedOptions}」的列表,併爲backing bean中的selectedOptions定義getter和setter。

相關問題