+ Start a Discussion
CraigHCraigH 

Correct way to handle apex include in managed packages

 

I am going through the process of packing an application.  I got it working ok in an unmanaged package.  I am now trying to get it working in a beta managed package.  After packaging and trying to install in a clean DE org, I am having an issue with one of the visualforce pages that does an <apex:include> to another page in the same package:

 

 

<apex:include pageName="AnotherPage"/> 

 

I am guessing it is failing due to a namespace issue.  I read in another thread that there are some potential changes in Summer 10 with respect to packaging & namespaces.

 

Does anybody know how to correctly reference another page an an apex:include so it works ok in Spring 10?

 

Will the issue above be fixed in Summer 10?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AishAish
<apex:include pageName="{!Page.AnotherPage}"/> 

All Answers

AishAish

try "{!$Page.othervfpgname}" instead of "otherpagename"

AishAish
<apex:include pageName="{!Page.AnotherPage}"/> 
This was selected as the best answer
CraigHCraigH

Slight correction to code - missing $

 

 

<apex:include pageName="{!$Page.AnotherPage}"/> 
AishAish
yes, thanks! typo!
CraigHCraigH

I spoke too soon - for some reason this does not work by having the page reference directly in visualforce (although based on the reference manual it should).

 

Instead, I just referenced a getter on a controller and had the controller return the page using Page.anotherPage