I have a number of components that all share the same controller but have slightly different layouts.
Everything's working great but for part of it to work in trying to find a way to tell the controller which component it is that's calling it?
If it were a regular page i would just use ApexPages.currentPage().getUrl()
. But I can't seem to find a way to of anything similar with a component?
I even tried to just create a parameter like this in the component
<apex:attribute name="page" description="This is the page." type="String" assignTo="{!pageName}"/>
where i would pass the page name along with the controller call, like so
<c:PrintBankFees page="PrintBankFees" />
but that doesnt seem to work either?
in my controller i have (simplified greatly to focus on the issue in question)
public String pageName {get;set;}
public String instructions {get;set;}
public PrintController() {
instructions = pageName;
}
and my component is setup like
<apex:component controller="PrintController">
<apex:attribute name="page" description="This is the page." type="String" assignTo="{!pageName}"/>
<apex:outputText escape="false" Value="{!instructions}" />
</apex:component>
but instructions is always blank?