function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Superdome-oldSuperdome-old 

apex:include doesn't support parameters at all!!

Try this:

 

Parent page (name: page1):

 

<apex:page controller="myTest">

   pageRef: {!pageRef}<br/>
    <apex:include pageName="{!pageRef}"/>
</apex:page>

 

Child page (name: page2):

 

<apex:page showHeader="false" sidebar="false">
    pp: {!$CurrentPage.Parameters.pp}
</apex:page>

 

Controller:

 

public class myTest{
    
    Public PageReference pageRef{get;private set;}
    
    public myTest() {
        pageRef = Page.page2;
        pageRef.getParameters().put('pp','2012');
    }
}

 

The result shows:

 

/apex/page2?pp=2012
pp:

^^^

apex:include doesn't support parameters at all!! Even it's there.......

 

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Of course it does. To supply parameters to a page in testing, use ApexPages.currentPage().getParameters, not a page reference to the page you're testing, which isn't the current page.

All Answers

sfdcfoxsfdcfox

Of course it does. To supply parameters to a page in testing, use ApexPages.currentPage().getParameters, not a page reference to the page you're testing, which isn't the current page.

This was selected as the best answer
Superdome-oldSuperdome-old

It was a report pages for many units.

 

The report page is the page2, and it is for one unit.

 

Since the report is so complex, and the number of units is huge.

 

We dont want to write a new page for running all of the report at once. It's not smart, and it should be solved by a loop logics.

 

So, I tried to use page1 to call page2 as a loop to run the reports for all units at once.

 

If the apex:include can support parameters, then the loop is so easy to call the report page from another page (report form), however, it's not.

 

Thanks for confirmation.