Provided you have a Visualforce page that uses both a standard controller and an extension class. The extension class has a method with the same name as a method in the standard controller

(i.e, public save())

If you have the following button in your page:

<apex:commandButton value ="save" action="{!save}" />

will this call the method from the standard controller or the extension?

  • Refer to the link where it has been already answered. A suggestion here -- the easiest and best way is to write a quick PoC and review the results in such scenarios. – Jayant Das Jul 20 '18 at 16:50

Any extension methods take precedence over controller methods with the same name. Take a look at Building a Controller Extension:

Multiple controller extensions can be defined for a single page through a comma-separated list. This allows for overrides of methods with the same name. For example, if the following page exists:

<apex:page standardController="Account"
    extensions="ExtOne,ExtTwo" showHeader="false">
    <apex:outputText value="{!foo}" />

with the following extensions:

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';

The value of the <apex:outputText> component renders as foo-One. Overrides are defined by whichever methods are defined in the “leftmost” extension, or, the extension that is first in the comma-separated list. Thus, the getFoo method of ExtOne is overriding the method of ExtTwo.

If you have exactly one extension defined, it is "leftmost".

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.