Let's say there are two tabs. I want to show a button below p:tabView if the user is on the first page and on the other hand I want to not to render that button if the user is on the second page. How can I ahieve this functionality? My code:
<h:form id="fr">
<p:tabView id="tabV" activeIndex="#{mngr.tabIndex}">
<p:ajax event="tabChange" listener="#{mngr.onTabChanged}" update=":fr:button"/>
<p:tab>
Tab one
</p:tab>
<p:tab>
Tab two
</p:tab>
</p:tabView>
<p:commandButton id="button" rendered="#{mngr.tabIndex == 0}"/>
</h:form>
Button is rendered whether you are on first or second tab, however things get differet if you manually refresh the page, then button rendering is working as intended. How can I update that button on tab change event?