绑定到commandbutton的方法从未因javax.el.PropertyNotWritableException而调用

时间:2013-06-25 06:39:55

标签: jsf-2 jboss7.x managed-bean

当我单击commandButton时,它永远不会进入托管bean中的绑定方法,但会出现异常:

  

javax.el.PropertyNotWritableException:/configuration.xhtml @ 22,73   value ="#{configurationBean.maxResUse}":班级   ' ch.morphean.videoaid.lb.managedBean.ConfigurationBean'不具有   可写属性' maxResUse'。

ManagedBean:

公共类ConfigurationBean {

private List<String> policy = new ArrayList<String>();
private int timeOut;
private String email;
private boolean secondary;
private short maxResUse;
private String selectedPolicy;

public String getSelectedPolicy() {
    return selectedPolicy;
}

public void setSelectedPolicy(String selectedPolicy) {
    this.selectedPolicy = selectedPolicy;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public boolean isSecondary() {
    return secondary;
}

public void setSecondary(boolean secondary) {
    this.secondary = secondary;
}

public int getMaxResUse() {
    return maxResUse;
}

public void setMaxResUse(short maxResUse) {
    this.maxResUse = maxResUse;
}

public int getTimeOut() {
    return timeOut;
}

public void setTimeOut(int timeOut) {
    this.timeOut = timeOut;
}
public List<String> getPolicy() {
    return policy;
}

public void setPolicy(List<String> policy) {
    this.policy = policy;
}

@PostConstruct
public void init() {
    List<PolicyDTO> p = getPolicies();
    for (PolicyDTO pdto : p) {
        policy.add(pdto.getName());
    }
    ConfigurationResponse conf = getConfig();
    this.email = conf.getEmailAlert();
    this.maxResUse = conf.getMaxResUse();
    this.timeOut = conf.getTimeOut();
}

public String saveConfig() {
    System.out.println("action");

configuration.xhtml:

<f:view>
    <h:form>
        <h:panelGrid columns="2">
            <h:outputLabel value="Balancing policy" />
            <h:selectOneListbox value="#{configurationBean.selectedPolicy}">
                <f:selectItems value="#{configurationBean.policy}" />
            </h:selectOneListbox>
            <h:outputLabel value="Time out (ms)" />
            <h:inputText value="#{configurationBean.timeOut}" />
            <h:outputLabel value="maximum use ressource %" />
            <h:inputText maxlength="2" value="#{configurationBean.maxResUse}" />
            <h:outputLabel value="Secondary" />
            <h:selectBooleanCheckbox value="#{configurationBean.secondary}" />
            <h:outputLabel value="Email alert" />
            <h:inputText value="#{configurationBean.email}" />
            <h:commandButton action="#{configurationBean.saveConfig}"
                value="start" />
        </h:panelGrid>
    </h:form>

</f:view>

面-配置:

<managed-bean>
    <managed-bean-name>configurationBean</managed-bean-name>
    <managed-bean-class>ch.morphean.videoaid.lb.managedBean.ConfigurationBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

感谢您的帮助

0 个答案:

没有答案