0
我看起來像一個菜單:號碼:菜單項不調用動作監聽
<h:form>
<p:menu>
<p:menuitem value="One" actionListener="#{tabsVO.changeTab(1)}" update="tabView"/>
<p:menuitem value="Two" actionListener="#{tabsVO.changeTab(2)}" update="tabView"/>
<p:menuitem value="Three" actionListener="#{tabsVO.changeTab(3)}" update="tabView"/>
</p:menu>
</h:form>
相應的bean:
@ManagedBean
@ViewScoped
public class TabsVO{
private int currentTab;
@PostConstruct
public void init() {
currentTab = 0;
}
public void changeTab(int tabIndex){
this.currentTab = tabIndex;
}
public int getCurrentTab() {
return currentTab;
}
public void setCurrentTab(int currentTab) {
this.currentTab = currentTab;
}
}
一切似乎都不錯,但不調用action listener
並沒有任何反應上點擊菜單項。