Controllers with apex:include and apex:composition
If you can afford to put the markup in the entry point page, this may be interesting:
- apex:include targets cannot traverse standard controllers
- but apex:composition defines can traverse included pages
Otherwise I think the only way Visualforce can talk to other Visualforce is by using an apex:component
that exposes an apex:attribute
.
With both apex:include
and apex:composition
the 'inners' are evaluated and flattened before they get inserted.
re: includes:
Can I use {!properties} from OuterPageController?
Nope.
re: compositions:
Can I use {!properties} from OuterPageController?
Also nope, those properties can only be evaluated from inside the apex:define
block.
Can I test or examine the contents of an in my inner controller?
Not from the inner controller :-( there's no way to get a handle on the value of an <apex:insert />
as a variable or property.
Composition refers to a VF page which can be used as a template, it assumed it will have the insert component, which refer back to the page's define components.
Include is similar in function, but is really more for when you aren't trying to design a template. You just need to pull that VF page into another.
The different pages do not require a controller, but they can. The context is similar to embedding custom components.