Hi Tanu,
Multiple controller extensions can be defined for a single page through a comma-separated list.
If both extension having same method, whichever methods are defined in the “leftmost” extension, or, the extension that is first in the comma-separated list will execute first.
For eg:-
Visualforce Page:-
<apex:page standardController=”Account”
extensions=”ExtOne,ExtTwo” showHeader=”false”>
<apex:outputText value=”{!foo}” />// this formula field first call the foo from ExtOne extension.
</apex:page>
For Extension:-
public class ExtOne {
public ExtOne(ApexPages.StandardController acon) { }
public String getFoo() {
return ‘foo-One’;
}
}
public class ExtTwo {
public ExtTwo(ApexPages.StandardController acon) { }
public String getFoo() {
return ‘foo-Two’;
}
}
If both having different method then it will execute based on formula {! } which method you are calling
Extension Example:-
public class OneExt {
public OneExt(ApexPages.StandardController controller) { }
public String getFood() {
return ‘OneExt’;
}
}
public class TwoExt {
public TwoExt(ApexPages.StandardController controller) {}
public String getFoo() {
return ‘TwoExt’;
}
}
Visualforce page:-
<apex:page standardController=”Account” extensions=”ExtOne,ExtTwo” showHeader=”false”>
<apex:outputText value=”{!foo}”/> //This formula field will call foo() from the TwoExt extension.
</apex:page>