<apex: include> Component in Visualforce Page
The <apex: include> component is another important component in the Visualforce page that is used for inserting a new VF page into the current page. The entire page subtree is injected into the VF DOM at the point of reference, and the scope of the included page is maintained.
Instead of using the <apex: include> component, we use the <apex: composition> component when the content should be stripped from the included page.
The <apex: include> componenthas the following attributes:
The id is a string type attribute, i.e., a unique identifier that allows the inserted page to be referenced by other components in the page.
The pageName is an ApexPages.PageReference type attribute, i.e., a VF page whose content needs to be inserted into the current page. The name of the Visualforce page is passed as a value to this attribute.
The rendered is a Boolean type attribute that is used for specifying whether this component needs to be rendered on the page or not. By default, its value is set to true.
Let's take an example to understand how we can use the <apex: include> component on the Visuaforce page: