I'm having difficulty getting a dynamicContent control to work the way I would like it. I found this bit of code in pasteBin and I think it might just be what I need, but I would like to understand what it is doing before I try implementing it.
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button value="Switch!" id="switchButton">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="dynamicCustomControl">
<xp:this.action><![CDATA[#{javascript:viewScope.controlName = 'cc_test2.xsp';
getComponent('dynamicCustomControl').show(null)}]]></xp:this.action>
</xp:eventHandler></xp:button>
<xe:dynamicContent id="dynamicCustomControl">
<xp:include id="customControlInluder">
<xp:this.pageName>
<![CDATA[${javascript:viewScope.controlName||"cc_test1.xsp"}]]>
</xp:this.pageName>
</xp:include>
</xe:dynamicContent>
</xp:view>
In particular I don't understand the syntax of this line:
<![CDATA[${javascript:viewScope.controlName||"cc_test1.xsp"}]]>
I prefer to use viewScope.get("controlName") rather than the short form viewScope.controlName but I don't understand the significance of the || in this line of code.
also the line
<xp:include id="customControlInluder>
is probably an inconsequential typo.
The process looks fairly simple and would appears that it would do the job for me. Just want to make sure I understand it before going down that road.
Edit and update ---
This very brief code snippet might just be one of the best kept secrets around. I have just worked through it and each of the Custom Controls displayed withing the dynamicCustomControl contains a dynamicContent control. So was able to very nicely embedded a dynamicContent inside a dynamicContent. Which to this point I was never really able to get to work correctly. Now it works very smoothly with minimal fuss & muss. Thanks for the comments and assistance.