title: Change Tab from Backing bean using JSF 2.0
body: <p>I want to change tab from backing bean , how can I do that?</p>
  
  <pre><code>&lt;h:form id=form&gt;  
  
      &lt;p:growl id="growl" showDetail="true" /&gt;  
  
      &lt;p:tabView id="tabView" dynamic="true" widgetVar="detailsTab"&gt;  
  
          &lt;p:ajax event="tabChange" listener="#{bean.onTabChange}" update=":form:growl"/&gt;  
  
          &lt;p:tab title="Tab1" id="emp"&gt;  
              &lt;h:panelGrid columns="2" cellpadding="10"&gt;  
  
  
                &lt;/h:panelGrid&gt;  
          &lt;/p:tab&gt;  
  
          &lt;p:tab title="Tab 2 " id="schedule1"&gt;  
              &lt;h:panelGrid columns="2" cellpadding="10"&gt;  
  
  
              &lt;/h:panelGrid&gt;  
  
  
  
          &lt;/p:tab&gt;  
  
          &lt;p:tab title="Tab 3" id="schedule2"&gt;  
          &lt;p:schedule value="#{bean.eventModel}" slotMinutes="15" 
                              resizable="false" widgetVar="schdule" initialDate="#{bean.dates}" draggable="true" styleClass="#{bean.selDates}"
                               &gt;
                               &lt;p:ajax event="dateSelect" listener="#{bean.onDateSelect}"
                                  update="dialogBox"  oncomplete="patScheduleDialog.show()"/&gt;
                                &lt;p:ajax event="eventSelect" listener="#{bean.onEventSelect}" 
                                  update="dialogBox :form:growl" oncomplete="#{bean.pevent}"/&gt;
                                  &lt;p:ajax event="eventMove" listener="#{bean.onEventMove}"
                                  update="dialogBox, :form:growl" /&gt;
                          &lt;/p:schedule&gt;
  
           &lt;p:dialog id="dialogBox" header="Patient's Appointment Details" widgetVar="patScheduleDialog" resizable="true"  
                                   showEffect="explode" hideEffect="explode"&gt;  
  
                  &lt;h:panelGrid id="eventDetails" columns="2"&gt;  
              &lt;h:outputLabel for="title" value="Title:" /&gt;  
              &lt;p:inputText id="title" value="#{bean.event.title}" required="true"/&gt;  
  
              &lt;h:outputLabel for="from" value="From:" /&gt;  
              &lt;p:inputMask id="from" value="#{bean.event.startDate}" mask="99/99/9999"&gt;  
                  &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
              &lt;/p:inputMask&gt;  
  
              &lt;h:outputLabel for="to" value="To:" /&gt;  
              &lt;p:inputMask id="to" value="#{bean.event.endDate}" mask="99/99/9999"&gt;  
                  &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;  
              &lt;/p:inputMask&gt;  
  
              &lt;h:outputLabel for="allDay" value="All Day:" /&gt;  
              &lt;h:selectBooleanCheckbox id="allDay" value="#{bean.event.allDay}" /&gt;  
  
              &lt;p:commandButton type="reset" value="Reset" /&gt;  
              &lt;p:commandButton value="Save" actionListener="#{bean.addEvent}" oncomplete="schdule.update();dialogBox.hide();"/&gt;  
          &lt;/h:panelGrid&gt;  
  
  
      &lt;/p:dialog&gt;
  
  
          &lt;/p:tab&gt;  
  
      &lt;/p:tabView&gt;  
  
  
    public void onEventSelect(ScheduleEntrySelectEvent selectEvent){
  
      // what should I need to do here to set "Tab 2" if click on any event.
  
  
      }
  </code></pre>