+ Start a Discussion
yaramareddy radhikayaramareddy radhika 

What is the difference between StandardController, Apexpages.StandardController and Apexpages.StandardSetController?

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Radhika,
  • ApexPages.StandardController (documentation) encapsulates just a single Sobject (e.g. Account, Opportunity).
  • ApexPages.StandardSetController (documentation) contains a list of records (one or more) and has additional functions to facilitate pagination (moving between pages) and updating a number of records at once.
I hope it will be helpful.

Please mark it as best answer if resolved the issue.

Amit Chaudhary 8Amit Chaudhary 8
Please check below post for more information
1) http://salesforce.stackexchange.com/questions/112380/diffrence-between-standardcontroller-and-standardsetcontroller
2) http://salesforce.stackexchange.com/questions/48199/what-is-the-difference-between-list-controllers-and-set-controllers
3) https://www.slideshare.net/developerforce/df121239-ready

StandardController Class

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.
public class myControllerExtension {

    private final Account acct;
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public myControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();

    public String getGreeting() {
        return 'Hello ' + acct.name + ' (' + acct.id + ')';

StandardSetController Class

StandardSetController objects allow you to create list controllers similar to, or as extensions of, the pre-built Visualforce list controllers provided by Salesforce

The StandardSetController class also contains a prototype object. This is a single sObject contained within the Visualforce StandardSetController class. If the prototype object's fields are set, those values are used during the save action, meaning that the values are applied to every record in the set controller's collection. This is useful for writing pages that perform mass updates (applying identical changes to fields within a collection of objects).
public class opportunityList2Con {
    // ApexPages.StandardSetController must be instantiated
    // for standard list controllers
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Name, CloseDate FROM Opportunity]));
            return setCon;

    // Initialize setCon and return a list of records
    public List<Opportunity> getOpportunities() {
        return (List<Opportunity>) setCon.getRecords();

Let us know if this will help you