Newer Version Available

This content describes an older version of this product. View Latest

StandardController Class

Use a StandardController when defining an extension for a standard controller.

Namespace

ApexPages

Usage

StandardController objects reference the pre-built Visualforce controllers provided by Salesforce. The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. StandardController is the data type of the single argument in the extension class constructor.

Instantiation

You can instantiate a StandardController in the following way:

Example

The following example shows how a StandardController object can be used in the constructor for a standard controller extension:

The following Visualforce markup shows how the controller extension from above can be used in a page: