When you use <apex:include> or <apex:composition>, what happens for controllers?
Does each of those apex:pages need its own controller?
apex:include
<apex:page title="Outer Page" controller="OuterPageController">
<apex:include page="InnerPage"/>
</apex:page>
<apex:page title="Inner Page" controller="InnerPageController">
1. Can I use {!properties} from OuterPageController?
2. If both pages use the same controller type, is the same
instance used, or are there two instances?
</page>
apex:composition
<!-- Page: composition -->
<apex:page>
<apex:outputText value="(template) This is before the header"/><br/>
<apex:insert name="header"/><br/>
<apex:outputText value="(template) This is between the header and body"/><br/>
<apex:insert name="body"/>
3. Can I use {!properties} from OuterPageController?
4. If both pages use the same controller type, is the same
instance used, or are there two instances?
5. Can I test or examine the contents of an <apex:insert> in my inner controller?
</apex:page>
<apex:page controller="outerPageController">
<apex:composition template="composition">
<apex:define name="header">
(page) This is the header of mypage
</apex:define>
<apex:define name="body">
(page) This is the body of mypage
</apex:define>
</apex:composition>
</apex:page>