You need to sign in to do that
Don't have an account?
Expressions in template composition cause dynamic elements not to render
I have a case where it seems that whether the value for the template attribute in the apex:composition tag is a literal or expression determines whether dynamic elements get rendered or not.
My controller looks like this:
public class SimpleController { public Component.Apex.OutputText dynamictest {get; set;} public PageReference pageRef {get; set;} public SimpleController(){ this.pageRef = Page.SimpleComposition; this.dynamictest = new Component.Apex.OutputText(); this.dynamictest.value = 'This is the dynamic output text'; } }
My page looks like this:
<apex:page controller="SimpleController"> <apex:composition template="{!pageRef}" /> </apex:page>
My template looks like this:
<apex:page controller="SimpleController"> This is a simple composition<br /> <apex:dynamicComponent componentValue="{!dynamictest}" rendered="true"/> </apex:page>
I expect that when I go to the page I will get:
This is a simple composition
This is the dynamic output text
what I acutally get is:
This is a simple composition
If I change the experession for template to a literal like this:
<apex:composition template="SimpleComposition" />
Then I get the expected result, so it seems that dynamic components behave differently in compositions based on whether or not the template is referenced in the tag with an expression or a literal. On the surface it would seem that this should not be the case. Is there any explenation as to why this would be?
I opened a case in the partner portal but they've made a change and only give developer support to paying partners now :o( . They directed me here. Hopefully someone can help me :)