javax.el.PropertyNotWritableException: value=“”: Illegal Syntax for Set Operation [duplicate]

混江龙づ霸主 提交于 2019-12-02 07:40:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!