-2

my error :

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

my 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>

my bean :

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

I cant submit the form

Tiny
  • 27,221
  • 105
  • 339
  • 599
anonimosz
  • 7
  • 6
  • Please read this answer: https://stackoverflow.com/a/2090062/1144326 – Ouerghi Yassine Jun 16 '17 at 02:16
  • Possible duplicate of [javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation](https://stackoverflow.com/questions/14540153/javax-el-propertynotwritableexception-illegal-syntax-for-set-operation) – Kukeltje Dec 06 '18 at 09:09

1 Answers1

0

The value attribute should not have getter method as value as it will be used for setting selected values as well. Use a list like value="#{userRepoeting.selectedOptions}" and define getter and setter for selectedOptions in the backing bean.

OTM
  • 656
  • 5
  • 8