0

commandButton をクリックすると、マネージド Bean のバインドされたメソッドに入ることはありませんが、例外が発生します。

javax.el.PropertyNotWritableException: /configuration.xhtml @22,73 value="#{configurationBean.maxResUse}": クラス「ch.morphean.videoaid.lb.managedBean.ConfigurationBean」には、書き込み可能なプロパティ「maxResUse」がありません。

マネージドBean:

パブリック クラス 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");

構成.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>

助けてくれてありがとう

4

0 に答える 0