0

这是一个 JSF 1.1 表单

<h:form>
    <h1>STEP 1 - Choose your channels</h1>        
        <h:selectManyCheckbox value="#{globalTVRegistration.selectedChannels}" layout="pageDirection">
            <f:selectItems value="#{globalTVRegistration.availableChannels}" />                
        </h:selectManyCheckbox>
    <h:commandButton value="Select Channels" action="packages" />
</h:form>

及其对应的backing bean

public class GlobalTVRegistration {

    private int[] selectedChannels;

    public int[] getSelectedChannels() {
        return selectedChannels;
    }

    public void setSelectedChannels(int[] selectedItems) {
        this.selectedChannels = selectedItems;
    }

}    

当我选择一个或多个复选框并单击命令按钮时,再次刷新同一页面。表单提交不调用setSelectedChannels(int[] selectedItems)

你能找出问题所在吗?

4

1 回答 1

1

万一其他人也面临同样的问题,在线

private int[] selectedChannels;

用Integer替换int数据类型。

于 2013-07-25T10:23:36.603 回答