1

JSP code

<t:panelTabbedPane align="left"  serverSideTabSwitch="false" styleClass="tabbedPane" 
            activeTabStyleClass="activeTab" inactiveTabStyleClass="inactiveTab" width="100%" cellpadding="0"
            cellspacing="0" tabContentStyleClass="tabContent" style="margin-top:0px;text-align:center"
            selectedIndex="#{myBB.selectedTab}">

/*******************************************/

Backing Bean Code:

private int selectedIndex;



    public int getSelectedIndex() {
        System.out.println("getter of selectedIndexis called "+selectedIndex);
        return selectedIndex;
    }

    public void setSelectedIndex(int selectedIndex) {
        System.out.println("Setter of selectedIndexis called "+selectedIndex);
        this.selectedIndex= selectedIndex;
    }

The backing bean is of session scope. When i change panelTab in the screen and click on submit button, always the default panel is being shown. I checked the console to find the sysout from setter of selectedIndex.But in console it is not being printed which means(I suppose) the selectedIndex is not being posted to the server.I'm using JSF version 1.1. Can any one suggest how to make this work ?

4

2 回答 2

1

根据文档selectedIndex是要使用的默认选项卡索引,而不是当前实际选择的选项卡索引。

话虽如此,您可以使用 a<t:tabChangeListener>来选择当前选定的选项卡。

于 2013-04-30T12:01:50.557 回答
1

对于任何可能遇到此问题的人:

您需要设置 serverSideTabSwitch="true" 并使用 tabChangeListener,否则选项卡切换(和已知的选项卡索引)完全在客户端完成。

于 2014-06-06T12:07:07.620 回答