Tabsheet - Remembering last active tab

Hello All,
How do I make the tabsheet remember the last tab selected and show it when the page is reloaded? Right now, the first tab is selected everytime I reload the page.



if you could save the last active tabsheet caption, you could compare it with the other captions. For example:

String selectedTabSheet = tabSheet.getSelectedTab().getCaption();

after you reload the page you can do something like this:

final Iterator<Component> i = tabSheet.getComponentIterator();
while (i.hasNext())
	final Component c =;
	final Tab tab = tabSheet.getTab(c);
	if (selectedTabSheet.equals(tab.getCaption()))

I dont know if this is the right way but it works.


If the selected tab is not remembered when reloading the page, it is probably caused by the entire application state being discarded and a new instance initiated. This happens if you have ?restartApplication in your url or if you are using Vaadin 7 without root preserving enabled (Application.setRootPreserved).