Wednesday, January 22, 2014

How many Controllers can be used on single VF page

How many Controllers can be used on single VF page

Only one controller can be used salesforce. Other than them, Controller extension can be used. There may be more than one Controller extention.
Example :
<apex:page standardController="Account"
extensions="ExtOne,ExtTwo" showHeader="false">
<apex:outputText value="{!foo}" />
</apex:page>

if ExtOne and ExtTwo, both have the method getFoo() then the method of ExtOne will be executed.

A controller extension is any Apex class that contains a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller that you want to extend.


No comments:

Post a Comment