Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

apex:insert

A template component that declares a named area that must be defined by an <apex:define> component in another Visualforce page. Use this component with the <apex:composition> and <apex:define> components to share data between multiple pages.

Example

1<!-- Page: composition -->
2<!-- This page acts as the template. Create it first, then the page below.  -->	
3<apex:page>
4    <apex:outputText value="(template) This is before the header"/><br/>
5    <apex:insert name="header"/><br/>
6    <apex:outputText value="(template) This is between the header and body"/><br/>
7    <apex:insert name="body"/>
8</apex:page>
9            
10<!-- Page: page -->
11<apex:page>
12    <apex:composition template="composition">
13    <apex:define name="header">(page) This is the header of mypage</apex:define>
14    <apex:define name="body">(page) This is the body of mypage</apex:define>
15    </apex:composition>
16</apex:page>

The example above renders the following HTML:

1(template) This is before the header<br/>
2(page) This is the header of mypage<br/>
3(template) This is between the header and body<br/>
4(page) This is the body of mypage

Attributes

Attribute Name Attribute Type Description Required? API Version Access
name String The name of the matching define tag that provides the content to be inserted into this Visualforce page. Yes 10.0 global