I have a visual force page that is invoked on a custom button on opportunity detail page. I wanted to include another page to display some custom data to this visual force page . How do I pass a custom variable on opportunity to the controller of the page included? I wanted to display results on the included page when the main page is rendered.
main page:
<apex:page standardController="opportunity" extensions="CMEditController">
<apex:form >
<apex:outputPanel id="errorMessagespanel" >
<apex:pageMessages ></apex:pageMessages> </apex:outputPanel>
<apex:pageBlockSection title="Call Outcome Details" columns="2">
<apex:inputField value="{!opportunity.LeadSource}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton action="{!saveandclose}" value="Save" rerender="errorMessagespanel"/>
<apex:commandButton action="{!cancel}" value="Cancel" onclick="window.top.close()"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock >
<apex:include pageName="displayNotes"/>
</apex:pageBlock>
</apex:form>
</apex:page>
included page :
<apex:page Controller="NotesController" tabStyle="note">
<apex:dataTable value="{!notesList}" var="note" cellspacing="5">
<apex:column >
<apex:facet name="header">Note</apex:facet>
<DIV style= "width:100%;overflow:hidden;word-wrap:break-word">
<apex:outputText value="{!note.noteText}"/>
</DIV> </apex:column>
</apex:dataTable>
</apex:page>
Notes Controller needs a custom field data from opportunity to query Notes to be displayed.