users@javaserverfaces.java.net

Re: [ANNOUNCE] Pass parameter to panelTab of <t:panelTabbedPane

From: ChrisC <ChrisC_at_Dive100.Freeserve.co.uk>
Date: Tue, 27 Mar 2007 13:44:54 -0700 (PDT)

I have been trying the tabChangeListener but am still 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}" />


-- 
View this message in context: http://www.nabble.com/Pass-parameter-to-panelTab-of--%3Ct%3ApanelTabbedPane-tf3446642.html#a9700710
Sent from the javaserverfaces users mailing list archive at Nabble.com.