2009-07-15 43 views
1

我有一個JSF頁面,我需要預先檢查頁面上的其中一個複選框,當它第一次加載時。我會如何去做這件事?我知道我可以將控件綁定到後臺bean,但是在什麼時候我會設置值來填充selectmany項目?jsf - 如何預先檢查selectmanycheckbox項目?

我的頁面包含: -

<h:selectManyCheckbox 
    disabledClass="selectManyCheckbox_Disabled"  
    styleClass="selectManyCheckbox" id="checkbox2" 
    required="true" value="#{pc_Proposaldeclaration.selectedDistWho}" > 

    <f:selectItem itemLabel="item1" itemValue="Name1" /> 
    <f:selectItem itemLabel="item2" itemValue="Name2" /> 

</h:selectManyCheckbox> 

在制定任何幫助的「物品1」,以檢查在頁面加載讚賞!

回答

1

當您初始化(在構造函數或框架的Initialize方法中)時,您將預先選擇這些值。例如,JSF1.2具有@PostConstruct註釋,該註釋將在bean創建並可訪問上下文後執行。

相關問題