myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gur Eitan" <...@axismobile.com>
Subject RE: Selecting different tabs in panelTabbedPane
Date Mon, 18 Jul 2005 15:10:07 GMT
I tried using the suggestion below but it's problematic. I don't want to
change the selected index manually, as in this case, I'll need to update
ALL methods in my beans to set the selected index. For example: If I
have 2 tabs, tabA and tabB, each has 2 buttons - "save" and "cacnel",
bound to the corresponding methods "doSave" and "doCancel", I'll need to
update the code you suggested in all 4 doXXX methods (save and cancel in
both beans).

I was wondering whether I can tell the panelTabbedPane to remember from
which tab it came and return to that instead of always returning to the
default tab (which is 0).

-----Original Message-----
From: Turgay Zengin [mailto:turgayze@gmail.com] 
Sent: Monday, July 11, 2005 5:28 PM
To: MyFaces Discussion
Subject: Re: Selecting different tabs in panelTabbedPane

Hi,
You can change the selectedIndex of your TabbedPane:

HtmlPanelTabbedPane panel = (HtmlPanelTabbedPane)
getFacesContext().getViewRoot().findComponent("myForm:myPanelTabbedPane"
);
panel.setSelectedIndex(0); //or 1,2...

Then the tab with the index you just set will be rendered.
myForm and myPanelTabbedPane are the id's of the form and tabbed pane
on your jsp.

HTH,
Turgay

On 7/11/05, Gur Eitan <gur@axismobile.com> wrote:
> Hi
> I'm using the pannelTabbedPane component in my main jsp page. Each tab
> is referenced by a different jsp subview. I want to be able to control
> the tab rendered by the result of the last action.
> For example:
> Say I 2 tabs in my main page: emails and address book. Usually the
> default tab is the emails tab. But when I'm creating a new contact (in
> the address-book tab), and submitting the data, I want to go back to
the
> address-book tab. How can I control the selected tab after performing
an
> operation? Something like the faces-config.xml <navigation-case>
> element, but for the panelTabbedPane.
> 
> Thanks a lot
> 
>


Mime
View raw message