Background
[wp_ad_camp_1]
This article demonstrates how make any tab selected or activated by default.
Software Environment
- Windows 7 Professional SP1
- Eclipse – Kepler Release
- Java 1.7 (1.7.0_67 – Windows x86)
- JSF 2.2
- Downloaded, and referenced as part of a Dynamic Web Project in Eclipse
- Primefaces 4.0
- Downloaded from www.primefaces.org
- Place it in the project in WebContent\WEB-INF\lib and reference it
Your Facelet
[wp_ad_camp_2]
To make a tab selected by default, modify your tabView and use activeIndex attribute. Set it to 0, 1, or (n-1)th tab. 0 (zero) selects the left-most tab.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <p:tabView activeIndex="1"> <p:tab title="Tab0"> <ui:include src="appointment_schedule.xhtml"></ui:include> <ui:include src="appButton.xhtml"></ui:include> </p:tab> <p:tab title="Tab1" > <ui:include src="Tab1.xhtml"></ui:include> </p:tab> <p:tab title="Tab2"> <ui:include src="Tab2.xhtml"></ui:include> </p:tab> <p:tab title="Tab3"> <ui:include src="Tab3.xhtml"/> <ui:include src="appButton.xhtml"></ui:include> </p:tab> <p:tab title="Tab4"> <ui:include src="Tab4.xhtml"/> <ui:include src="appButton.xhtml"></ui:include> </p:tab> <p:tab title="Tab5"> <ui:include src="Tab5.xhtml"/> <ui:include src="appButton.xhtml"></ui:include> </p:tab> </p:tabView> |
[wp_ad_camp_3]