2012-09-12 13 views
-1

我想使用bean setter設置<h:selectOneMenu>的值,但它不起作用。這裏是我的.xml代碼:如何將<selectOneMenu>值設置爲bean變量?

<h:selectOneMenu value="#{adminActionController.tempBean.selectType}"> 
     <f:selectItem itemLabel="Check" itemValue="Check" /> 
     <f:selectItem itemLabel="Cash" itemValue="Cash"/> 
     <f:ajax event="change" listener="#{adminActionController.tempBean.changeType}"/> 
    </h:selectOneMenu> 

這裏是我的豆代碼:

protected String selectType; 

public String getSelectType() { 
    return selectType; 
} 

public void setSelectType(String selectType) { 
    this.selectType = selectType; 
} 

我嘗試了很多辦法,但事情至今下落不明。我不知道是什麼。 它爲bean設置了h:inputText值,但是我的下拉列表有問題。 任何人都可以幫助我嗎?

回答

3

嘗試不立即=「true」。並且selectOneMenu必須位於h:form內。當selectOneMenu更改時,您的偵聽器正在工作,對嗎?

+0

裏面h:表單thre是:datatable:rowexpansion:selectOneMenu 並且my:ajax偵聽器沒有觸及onChange事件。 在同一頁:inputText的它正在與該標籤 –

+0

我想如果不立即=「真」 BT不工作 –

+0

(設置值)BT的問題,如果你發佈你的聽衆代碼這將是很好藏漢 – PermGenError