0

How to make a tab selected by default in Pimefaces

Background

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

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.