Difference between Standard Controller and Custom Controller?

Standard Controller:

  • Standard controller in apex, inherits all the standard object properties and standard button functionality directly.
  • It contain the same functionality and logic that are used for standard Salesforce pages.
  • It Can be used with standard objects and custom objects.
  • It can be extended to implement custom functionality using extensions keyword.
  • It provides a save method to allow you to persist changes.
  • You’d use this when you have a singe object to manipulate.

Custom Controller:

  • It is an Apex class that implements all of the logic for a page without leveraging a standard controller.
  • Custom Controllers are associated with Visualforce pages through the controller attribute.
  • Custom controller defines its own functionality.
  • Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
  • You’d use this when your page isn’t dealing with a main object.

Leave a Reply