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

2 thoughts on “How to execute bean method when switching tab in ADF?

    1. Hi Latheef,

      sorry for such a long gap in response, just didn’t notice your comment notification on time. Anyway, if I understand the question correctly – we can’t associate two methods directly. But there should be no problem to wrap any splitted logic under single event listener method. Like this:

      public void onTabDiscloseSub1(DisclosureEvent disclosureEvent) {
      public void onTabDiscloseSub2(DisclosureEvent disclosureEvent) {
      public void onTabDisclose(DisclosureEvent disclosureEvent) {

      Kind Regards,

Leave a Reply

Your email address will not be published.