问题
I have this form:
<h:form>
<h:outputLabel value="Entrez un id du compte a supprimer" for="id"/>
<h:inputText id="id" value=""/>
<h:commandButton id="supprimer" value="Supprimer" action="#{compteBancaireMBean.supprimer}"/>
</h:form>
And this action method:
public String supprimer() {
gestionnaireDeCompteBancaire.supprimer(comptebancaire.getId());
return "CompteList";
}
When I submit the form, I get the following exception:
javax.el.PropertyNotWritableException: /Supprimer.xhtml @14,44 value="": Illegal Syntax for Set Operation
How is this caused and how can I solve it?
回答1:
value=""
does not mean anything to the JSF el parser, it can't make sense of that. You need to actually provide a static value there, as in value="Some Text"
or bind it to a variable in your backing bean as in value="#{compteBancaireMBean.myVariable}"
where myVariable
corresponds to an actual variable in your compteBancaireMBean
backing bean. This variable must follow the javabean conventions i.e. you must have
private Integer myVariable; //I use Integer here just as an example, you can use any core java type
public void setMyVariable(Integer myVariable){
this.myVariable = myVariable
}
public Integer getMyVariable(){
return this.myVariable
}
来源:https://stackoverflow.com/questions/13714081/javax-el-propertynotwritableexception-value-illegal-syntax-for-set-operatio