Salesforce Visualforce Overview

Visualforce is a technology used in for building custom user interfaces. It is analogous to Java Server Pages (JSP) with Java Server Faces (JSF) in Java technology. Visualforce uses Apex classes (controllers) containing business logic, and visualforce pages and visualforce components containing the presentation.

Visualforce Controllers

The visualforce controller is Apex class that is used to interact with database, and provide business logic behind visualforce pages. It uses variables to interact with presentation layer, and action methods to process user actions via buttons, links and events. provides default controller called standard controller, which replicates the behavior of native user interface. Custom behavior can be added by creating a custom controller, or adding controller extension to the standard controller.

  • Standard Controller - provides default controller implementation on every database object existing in platform including custom objects. No special Apex code is required to create standard controller, as it's already provide by the

    A standard controller is invoked with the standardController attribute.

    <apex:page standardController="Object">

    There are also standard list controllers that help manage list of objects. The controller to operate on a list is accomplished with the recordSetVar attribute. A list controllers can operate on maximum of 10,000 records at a time, and supports pagination for additional sets of records.

    <apex:page standardController="Contact" recordSetVar="contacts">
  • Custom Controller - A custom controller is a Apex class built entirely by the user. There is no default functionality, so each and every functionality has to be built from scratch.

    A custom controller is invoked with the controller attribute.

    <apex:page controller="Custom Controller Name">
  • Controller Extension - Controller extension allows a developer to use standard controller, and extend or override the functionality of default implementation with custom Apex code.

    A controller extension is invoked with the extensions attribute.

    <apex:page standardController="Object" extensions="ExtensionClass1, 

There are two type of methods defined within a controller: Data methods and Action methods.

  • Data methods are defined to set (setter methods) and get (getter methods) data between the page and Controller.
  • Action methods are created to perform business logic, and navigate user to a different page.

Visualforce Pages

The visualforce page defines presentation of a page using mixture of standard HTML, and XML markup. The XML markup is used to add view components to the page using XML tags defined in the visual force components.

View Components

Visualforce components is tag library used within Visualforce pages, which begin with the apex: prefix (i.e. ). View components bind the controller to the page, and maps data from the controller to the user interface.

Development Environment

As with any development, you may use native Salesforce UI or IDE as a development tool. As a developer, you can enable development mode on the native Salesforce UI to allow syntax highlighting and display an integrated help system. To enable development mode and show view state in development mode, click on your name on Salesforce UI -> My Settings -> Personal -> Advanced User Details -> click on the Edit button. To enable development mode, you must have Customize Application permission enabled.

Visualforce Developer's Guide Complete Reference


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.