[Tomahawk-users] tabChangeListener
Brought to you by:
bsmith1180,
dkolbly
From: Chris C. <Ch...@Di...> - 2007-03-29 13:04:20
|
I have been trying the tabChangeListener but am l having problems. As you can see from the code below I've added selectedIndex="#{tabSupport.selectedTabIndex}" serverSideTabSwitch="true" to the <t:panelTabbledPane, created a backing bean and included a output text in the page shown in the tab. But the selected index is always 0. <f:view> <h:form> <t:panelTabbedPane selectedIndex="#{tabSupport.selectedTabIndex}" serverSideTabSwitch="true"> <t:tabChangeListener type="myapp.tabSupport" /> <t:panelTab id="tab00" label="Tab00"> <f:subview id="inc1"> <jsp:include page="Page1.jsp" flush="false"> <jsp:param name="filter" value="all" /> </jsp:include> </f:subview> </t:panelTab> <t:panelTab id="tab01" label="Tab01" > <f:subview id="inc2"> <jsp:include page="Page1" flush="false"> <jsp:param name="filter" value="new" /> </jsp:include> </f:subview> </t:panelTab> </t:panelTabbedPane> </h:form> </f:view> package myapp; import java.io.Serializable; import org.apache.log4j.Logger; import org.apache.myfaces.custom.tabbedpane.TabChangeListener; import org.apache.myfaces.custom.tabbedpane.TabChangeEvent; public class tabSupport implements Serializable, TabChangeListener { private static final long serialVersionUID = 1; int selectedTabIndex; private final transient Logger logger = Logger.getLogger(myapp.tabSupport.class); public int getSelectedTabIndex() { return selectedTabIndex; } public void setSelectedTabIndex(int selectedTabIndex) { this.selectedTabIndex = selectedTabIndex; } public void processTabChange(TabChangeEvent event){ //logger.error("ZZ" + event.getNewTabIndex() + " " + event.getPhaseId()); //logger.error ("This bit executed"); this.selectedTabIndex = event.getNewTabIndex(); } } <managed-bean> <managed-bean-name>tabSupport</managed-bean-name> <managed-bean-class>myApp.tabSupport</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> In Page1.jsp <t:outputText value="ZXZ #{tabSupport.selectedTabIndex}" /> Using tomahawk 1.1.3 |