Visualforce Page Development
Basic page
A basic VisualForce page can be created like this:
<apex:page>
<h1>Hello, world!</h1>
</apex:page>Using Standard Controllers
If your page is for displaying or editing information about a particular type of record, it may be helpful to use a standard controller to reduce the amount of boilerplate code you need to write.
By using a standard controller, your page will be displayed with an ?id=SALESFORCE_ID parameter, and you automatically get access to all merge fields on the record.
Add a standard controller to your page by specifying the standardController attribute on <apex:page>:
<apex:page standardController="Account">
This is a page for {!Account.Name}
</apex:page>You also get the standard controller methods for free:
cancel()- returns thePageReferencefor the cancel page (usually navigates back to a list view)delete()- deletes the record and returns thePageReferencefor the delete pageedit()- returns thePageReferencefor the standard edit pagesave()- saves the record and returns thePageReferenceto the updated recordview()- returns thePageReferencefor the standard view page
You can use them like this:
<apex:page standardController="Account">
Name: <apex:inputField value="{!Account.Name}" />
<apex:commandButton value="Update record" action="{!save}" />
</apex:page>