How to execute bean method when switching tab in ADF?

Quite common requirement is  to execute some logic when navigating between tabs in ADF application. Luckily in ADF there is a straight forward feature enabling you to do this easily. Its enough just to add disclosureListener to showDetailItem of panelTabbed component and point it to dedicated bean method. Like this:

<af:panelTabbed position="above" id="pt1">
<af:showDetailItem id="tab1" text="Tab Label 1"/>
<af:showDetailItem id="tab2" text="Tab Label 2" disclosureListener="#{MyBean.onTabDisclose}"/>

Listener method signature must contain DisclosureEvent parameter:

public void onTabDisclose(DisclosureEvent disclosureEvent) {
System.out.println("You've just disclosed a TAB!");

Tiny sample application can be downloaded here.


ADF Version


About Danas Tarnauskas

Leave a Reply

Your email address will not be published.