2012-12-04 23 views
1

我有這樣的形式:javax.el.PropertyNotWritableException:價值= 「」:非法語法設定操作

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

,因此這個動作方法:

public String supprimer() { 
    gestionnaireDeCompteBancaire.supprimer(comptebancaire.getId()); 
    return "CompteList"; 
} 

當我提交表單,我得到以下例外:

javax.el.PropertyNotWritableException: /Supprimer.xhtml @14,44 value="": Illegal Syntax for Set Operation 

這是如何造成的,我該如何解決?

回答

4

value=""對於JSF el解析器來說並不意味着什麼,它不能說明這一點。您需要實際提供一個靜態值,如value="Some Text"或將其綁定到您的支持bean中的變量,如value="#{compteBancaireMBean.myVariable}",其中myVariable對應於您的compteBancaireMBean支持bean中的實際變量。此變量必須遵循javabean約定,即您必須擁有

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 
    } 
相關問題