Dynamic tab shell template selectedTabIndex is null
Hello everyone,
I am developing a application with the dynamic UI TabShell template, in my project i have a main page with one navigation pane and one region and i use a bean to create my navigation list which is fine. On click of navigation item the corresponding task-flow for that item will be rendered. I have a default taskflow which is set on my region on the page say 'WelcomeTF'. Now the problem i am facing is on click of my navigation item, it shows the corresponding taskflow and my WelcomeTF each time. I came to know that this is happening bcz my selected selectedTabIndex is always going as null. Can anyone pls help me hw do i fix this issue?
Main page with navigation list
-------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" title="Bug Tool">
<af:form id="f1" usesUpload="true">
<af:pageTemplate viewId="/Pages/MainTemplate.jspx" id="pt1" value="#{bindings.pageTemplateBinding}">
<f:facet name="menu">
<af:decorativeBox id="db2">
<f:facet name="center">
<af:panelAccordion id="pa1">
<af:showDetailItem text="Menu" id="sdi1" stretchChildren="first">
<af:tree id="tr0" var="menuItem" initiallyExpanded="true" contentDelivery="immediate"
summary="Menu Item"
value="#{MenuGeneratorBean.menuModel}">
<f:facet name="nodeStamp">
<af:group id="g2">
<af:commandLink id="cl0"
actionListener="#{TabLauncher.launchCurrentTabParamMap}"
textAndAccessKey="#{menuItem.label}"
rendered="#{menuItem.actionListener != null}"
partialSubmit="true" immediate="true">
<af:setPropertyListener from="#{menuItem.label}"
to="#{TabLauncher.dynamicTabTitle}"
type="action"/>
<af:setPropertyListener from="#{menuItem.actionListener}"
to="#{TabLauncher.dynamicTabTaskFlowId}"
type="action"/>
</af:commandLink>
<af:outputText id="op0" value="#{menuItem.label}"
rendered="#{menuItem.actionListener == null}"/>
</af:group>
</f:facet>
</af:tree>
</af:showDetailItem>
</af:panelAccordion>
</f:facet>
<f:facet name="top"/>
</af:decorativeBox>
</f:facet>
<f:facet name="welcome">
<af:region value="#{bindings.WelcomeTF.regionModel}" id="r1"/>
</f:facet>
<f:facet name="copyRight"/>
<f:facet name="about"/>
<f:facet name="toolbar"/>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
MainTemplate with regions
------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<c:set var="uicomponentsBundle"
value="#{adfBundle['UIComponents.UIComponentsBundle']}"/>
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<af:pageTemplateDef var="attrs">
<af:xmlContent>
<component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
<display-name>MainTemplate</display-name>
<facet>
<facet-name>welcome</facet-name>
</facet>
<facet>
<facet-name>copyRight</facet-name>
</facet>
<facet>
<facet-name>about</facet-name>
</facet>
<facet>
<facet-name>menu</facet-name>
</facet>
<facet>
<facet-name>toolbar</facet-name>
</facet>
</component>
</af:xmlContent>
<af:panelSplitter id="ps1" orientation="vertical" splitterPosition="50"
firstBorder="none" secondBorder="none">
<f:facet name="first">
<af:panelGroupLayout id="pgl1" layout="vertical">
<af:panelBorderLayout id="pbl1">
<f:facet name="start">
<af:panelGroupLayout id="pgl2">
<af:image source="/images/oracle.gif" id="i1"/>
</af:panelGroupLayout>
</f:facet>
<f:facet name="end">
<af:group id="g1">
<af:panelGroupLayout id="pgl3" layout="horizontal">
<af:spacer width="10" height="10" id="s1"/>
<af:navigationPane id="np2" hint="bar">
<af:commandNavigationItem text="#{uicomponentsBundle['MAIN.LOGOUT.LABEL.TEXT']}"
id="cni1"
icon="/images/logout.gif"
action="#{LoginBean.doLogout}"/>
</af:navigationPane>
</af:panelGroupLayout>
</af:group>
</f:facet>
<af:panelBorderLayout id="pbl2">
<f:facet name="top">
<af:panelGroupLayout id="pgl4"/>
</f:facet>
</af:panelBorderLayout>
</af:panelBorderLayout>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelStretchLayout id="psl1">
<f:facet name="bottom">
<af:panelStretchLayout id="psl2">
<f:facet name="start">
<af:facetRef facetName="copyRight"/>
</f:facet>
<f:facet name="end">
<af:facetRef facetName="about"/>
</f:facet>
</af:panelStretchLayout>
</f:facet>
<f:facet name="center">
<af:decorativeBox id="db1" theme="light">
<f:facet name="center">
<af:panelSplitter id="ps2" splitterPosition="130">
<f:facet name="first">
<af:facetRef facetName="menu"/>
</f:facet>
<f:facet name="second">
<af:panelStretchLayout id="psl3" topHeight="auto"
binding="#{viewScope.tabContext.toolbarArea}">
<f:facet name="center">
<af:panelStretchLayout id="pt_psl1" topHeight="22px">
<f:facet name="center">
<af:panelStretchLayout id="pt_psl2"
binding="#{viewScope.tabContext.contentArea}">
<f:facet name="center">
<af:group id="pt_g1">
<af:panelStretchLayout id="psl4"
rendered="#{viewScope.tabContext.selectedTabIndex != -1}"
styleClass="AFStretchWidth">
<f:facet name="center">
<af:facetRef facetName="welcome"/>
</f:facet>
</af:panelStretchLayout>
<af:region value="#{viewScope.tabContext.tabs[0].binding.regionModel}"
id="pt_r0"
rendered="#{viewScope.tabContext.selectedTabIndex == 0}"/>
<af:region value="#{viewScope.tabContext.tabs[1].binding.regionModel}"
id="pt_r1"
rendered="#{viewScope.tabContext.selectedTabIndex == 1}"/>
<af:region value="#{viewScope.tabContext.tabs[2].binding.regionModel}"
id="pt_r2"
rendered="#{viewScope.tabContext.selectedTabIndex == 2}"/>
<af:region value="#{viewScope.tabContext.tabs[3].binding.regionModel}"
id="pt_r3"
rendered="#{viewScope.tabContext.selectedTabIndex == 3}"/>
<af:region value="#{viewScope.tabContext.tabs[4].binding.regionModel}"
id="pt_r4"
rendered="#{viewScope.tabContext.selectedTabIndex == 4}"/>
<af:region value="#{viewScope.tabContext.tabs[5].binding.regionModel}"
id="pt_r5"
rendered="#{viewScope.tabContext.selectedTabIndex == 5}"/>
<af:region value="#{viewScope.tabContext.tabs[6].binding.regionModel}"
id="pt_r6"
rendered="#{viewScope.tabContext.selectedTabIndex == 6}"/>
<af:region value="#{viewScope.tabContext.tabs[7].binding.regionModel}"
id="pt_r7"
rendered="#{viewScope.tabContext.selectedTabIndex == 7}"/>
<af:region value="#{viewScope.tabContext.tabs[8].binding.regionModel}"
id="pt_r8"
rendered="#{viewScope.tabContext.selectedTabIndex == 8}"/>
<af:region value="#{viewScope.tabContext.tabs[9].binding.regionModel}"
id="pt_r9"
rendered="#{viewScope.tabContext.selectedTabIndex == 9}"/>
<af:region value="#{viewScope.tabContext.tabs[10].binding.regionModel}"
id="pt_r10"
rendered="#{viewScope.tabContext.selectedTabIndex == 10}"/>
<af:region value="#{viewScope.tabContext.tabs[11].binding.regionModel}"
id="pt_r11"
rendered="#{viewScope.tabContext.selectedTabIndex == 11}"/>
<af:region value="#{viewScope.tabContext.tabs[12].binding.regionModel}"
id="pt_r12"
rendered="#{viewScope.tabContext.selectedTabIndex == 12}"/>
<af:region value="#{viewScope.tabContext.tabs[13].binding.regionModel}"
id="pt_r13"
rendered="#{viewScope.tabContext.selectedTabIndex == 13}"/>
<af:region value="#{viewScope.tabContext.tabs[14].binding.regionModel}"
id="pt_r14"
rendered="#{viewScope.tabContext.selectedTabIndex == 14}"/>
</af:group>
</f:facet>
<f:facet name="top">
<af:panelBorderLayout id="pbl3"
styleClass="AFStretchWidth"
rendered="#{viewScope.tabContext.tabsRendered}">
<f:facet name="end">
<af:commandImageLink icon="/images/close.png"
hoverIcon="/images/closeHover.png"
actionListener="#{viewScope.tabContext.tabRemovedEvent}"
rendered="#{viewScope.tabContext.selectedTabIndex != -1}"
immediate="true"
partialSubmit="true"
textAndAccessKey="&Close"
id="pt_cil1"/>
</f:facet>
<af:navigationPane id="np1"
binding="#{viewScope.tabContext.tabsNavigationPane}"
rendered="#{viewScope.tabContext.selectedTabIndex != -1}"
value="#{viewScope.tabContext.tabMenuModel}"
var="tab">
<f:facet name="nodeStamp">
<af:commandNavigationItem id="tabIndex"
rendered="#{tab.active}"
actionListener="#{viewScope.tabContext.tabActivatedEvent}"
inlineStyle="#{tab.dirty ? 'font-style: italic' : ''}"
partialSubmit="true"
text="#{tab.title}"
immediate="false"
itemListener="#{viewScope.tabContext.tabRemovedEvent}"
remove="inherit">
<f:attribute name="tabIndex"
value="#{tab.index}"/>
</af:commandNavigationItem>
</f:facet>
</af:navigationPane>
</af:panelBorderLayout>
</f:facet>
</af:panelStretchLayout>
</f:facet>
<f:facet name="top">
<af:panelGroupLayout id="pt_pgl1"
binding="#{viewScope.tabContext.innerToolbarArea}">
<af:facetRef facetName="innerToolbar"/>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
</f:facet>
</af:panelStretchLayout>
</f:facet>
</af:panelSplitter>
</f:facet>
</af:decorativeBox>
</f:facet>
</af:panelStretchLayout>
</f:facet>
</af:panelSplitter>
<af:popup id="pt_toomanytabs" clientComponent="true" contentDelivery="lazy"
binding="#{viewScope.tabContext.tooManyTabsPopup}">
<af:dialog title="#{uicomponentsBundle.TOO_MANY_TABS_OPEN}" type="ok"
id="pt_d1">
<af:outputText value="#{uicomponentsBundle.TOO_MANY_TABS_OPEN_OT}"
id="pt_ot2"/>
</af:dialog>
</af:popup>
<af:popup id="pt_tabdirty" clientComponent="true" contentDelivery="lazy"
binding="#{viewScope.tabContext.tabDirtyPopup}">
<af:dialog title="#{uicomponentsBundle.WARNING__TRANSACTION_IS_DIRTY}"
type="yesNo" id="pt_d2"
dialogListener="#{viewScope.tabContext.handleDirtyTabDialog}">
<af:outputText value="#{uicomponentsBundle.TRANSACTION_UNCOMMITED}"
id="pt_ot3"/>
</af:dialog>
</af:popup>
</af:pageTemplateDef>
</jsp:root>
Template pagedef
--------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
version="11.1.1.61.92" id="Pages_MainTemplatePageDef" Package="Pages">
<parameters/>
<executables>
<variableIterator id="variables"/>
<taskFlow id="r0"
taskFlowId="${viewScope.tabContext.tabs[0].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[0].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r1"
taskFlowId="${viewScope.tabContext.tabs[1].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[1].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r2"
taskFlowId="${viewScope.tabContext.tabs[2].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[2].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r3"
taskFlowId="${viewScope.tabContext.tabs[3].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[3].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r4"
taskFlowId="${viewScope.tabContext.tabs[4].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[4].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r5"
taskFlowId="${viewScope.tabContext.tabs[5].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[5].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r6"
taskFlowId="${viewScope.tabContext.tabs[6].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[6].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r7"
taskFlowId="${viewScope.tabContext.tabs[7].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[7].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r8"
taskFlowId="${viewScope.tabContext.tabs[8].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[8].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r9"
taskFlowId="${viewScope.tabContext.tabs[9].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[9].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r10"
taskFlowId="${viewScope.tabContext.tabs[10].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[10].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r11"
taskFlowId="${viewScope.tabContext.tabs[11].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[11].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r12"
taskFlowId="${viewScope.tabContext.tabs[12].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[12].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r13"
taskFlowId="${viewScope.tabContext.tabs[13].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[13].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
<taskFlow id="r14"
taskFlowId="${viewScope.tabContext.tabs[14].taskflowId}"
parametersMap="${viewScope.tabContext.tabs[14].parameters}"
activation="deferred"
xmlns="http://xmlns.oracle.com/adf/controller/binding">
<parameters>
<parameter id="tabContext" value="${bindings.tabContext}"
xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
</parameters>
</taskFlow>
</executables>
<bindings/>
</pageDefinition>