In our previous Salesforce training tutorial we have learned about static resources in Salesforce.com. In this visualforce training tutorial we are going to learn about how How to insert Visual force page in another Visualforce page. Adding visualforce page in another visualforce page is very easy and also it is very helpful in creating different modular visualforce pages. Using Include component in visualforce we can add a visualforce pages in another visualforce.

What happens when visualforce pages is inserted ?

When visualforce page is inserted  using Include component, it embeds the content and properties of the include pages in the current page.

Inserting visualforce page in another VF page.

To insert VF page use include component and pagename attribute. This pagename attribute specifies the name of the visualforce page to be inserted. We have to give the exact name of the visualforce page.

Ex :- <apex:include pagename=”actionstatus”/>.

Let us create simple VF page.

Below shown is theVF page that we created using include component.

visualforce page

From above screenshot, we have used include component to add actionstatus VF page which we created in our previous salesforce tutorial. pageName=”actionstatus” includes actionstatus VF page to current apexinclude page.

Output

visualforce pageSuppose if there are multiple controller in included visualforce page then include component makes the controllers to isolate with each other and makes every controller to work independently.