Creating a Custom Controller Class

A custom controller is simply an Apex class. For example, the following code is a valid, though ineffective, controller class:

public class MyController {

}
You can create a controller class and add it to your page in two different ways:
Note

Note

A page can only reference one controller at a time. You can’t use both the standardController attribute and the controller attribute in an <apex:page> tag.

As soon as you save a page that references a valid custom controller, a second Controller editor tab is available next to the Page Editor. This editor allows you to toggle back and forth between your page markup and the Apex that defines the page’s logic.

The Custom Controller Editor A Visualforce page displaying a callout to the Controller Editor