XPages中的嵌套表达式语言语法

XPages中的嵌套表达式语言语法,xpages,Xpages,我正在重构一个模拟Notes客户端讨论数据库的XPage。(不要问) 我创建了一个托管Bean,它将所有导航信息加载到一个树中,并创建了一组访问托管Bean的嵌套重复控件 我遇到了折叠和展开函数的问题。最初的作者通过访问包含下一级条目的面板来使用客户端JavaScript。他们通过硬编码来实现这一点。1000行XML,也就是说 <xp:this.script><![CDATA[collapse("#{id:repeatcontrolpanel3}]}")]]></x

我正在重构一个模拟Notes客户端讨论数据库的XPage。(不要问)

我创建了一个托管Bean,它将所有导航信息加载到一个树中,并创建了一组访问托管Bean的嵌套重复控件

我遇到了折叠和展开函数的问题。最初的作者通过访问包含下一级条目的面板来使用客户端JavaScript。他们通过硬编码来实现这一点。1000行XML,也就是说

<xp:this.script><![CDATA[collapse("#{id:repeatcontrolpanel3}]}")]]></xp:this.script>
错误

是否有一种特殊的语法,即从自定义控件的属性中获取一个字符串值,然后让该字符串用#{id:}求值,或者是否缺少一个更优雅的方法


谢谢你的帮助。

我最终通过在外部构建必要的脚本解决了这个问题。这里我有一个导航条目自定义控件,它有两个字符串属性:script\u expand和script\u collapse

<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"> 
<xp:panel
    id="outerpanel"
    styleClass="NavLeftRow"
    style="#{compositeData.node.styleShowOnFirstLoad}">
    <xp:panel
        id="innerpanel">
        <xp:this.styleClass><![CDATA[#{compositeData.node.inBreadCrumbPath ?  compositeData.panelStyleWhenActive : compositeData.panelStyleWhenInactive}]]></xp:this.styleClass>
        <xp:image
            id="imgCollapsed"
            url="/xpSectionCollapsed_oneUI.gif">
            <xp:this.style><![CDATA[#{compositeData.node.styleHideIfInBreadCrumb}]]></xp:this.style>
            <xp:this.rendered><![CDATA[#{compositeData.node.hasChildren}]]></xp:this.rendered>
            <xp:eventHandler
                event="onclick"
                submit="false">
                <xp:this.script><![CDATA[#{javascript:compositeData.script_expand}]]></xp:this.script>
            </xp:eventHandler>
        </xp:image>         
    </xp:panel>
</xp:panel>

脚本函数从外部调用;我只是通过手动操作来减轻计算相关ID的问题

<xp:repeat
        id="repeatfourthlevelnodes"
        rows="200"
        var="fourthlevelnode"
        value="#{thirdlevelnode.children}">
    <xc:ccPanelNavigation
            node="#{fourthlevelnode}">
        <xc:this.script_expand>
            <![CDATA[expand("#{id:repeatfifthlevelnodes}");]]>
        </xc:this.script_expand>
    </xc:ccPanelNavigation>
</xp:repeat>

不像我希望的那样优雅,但比未经分解的代码要好得多


这是斯文的答案,这真的很有帮助,所以这真的应该给他

Try:#{id:compositeData.NameNestedRepeatControl}不,似乎不起作用。我现在正试图通过属性发送脚本。这有帮助吗?#{id:eval(compositeData.NameNestedRepeatControl)}迈克尔,不。它的计算结果为空字符串。
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"> 
<xp:panel
    id="outerpanel"
    styleClass="NavLeftRow"
    style="#{compositeData.node.styleShowOnFirstLoad}">
    <xp:panel
        id="innerpanel">
        <xp:this.styleClass><![CDATA[#{compositeData.node.inBreadCrumbPath ?  compositeData.panelStyleWhenActive : compositeData.panelStyleWhenInactive}]]></xp:this.styleClass>
        <xp:image
            id="imgCollapsed"
            url="/xpSectionCollapsed_oneUI.gif">
            <xp:this.style><![CDATA[#{compositeData.node.styleHideIfInBreadCrumb}]]></xp:this.style>
            <xp:this.rendered><![CDATA[#{compositeData.node.hasChildren}]]></xp:this.rendered>
            <xp:eventHandler
                event="onclick"
                submit="false">
                <xp:this.script><![CDATA[#{javascript:compositeData.script_expand}]]></xp:this.script>
            </xp:eventHandler>
        </xp:image>         
    </xp:panel>
</xp:panel>
<xp:repeat
        id="repeatfourthlevelnodes"
        rows="200"
        var="fourthlevelnode"
        value="#{thirdlevelnode.children}">
    <xc:ccPanelNavigation
            node="#{fourthlevelnode}">
        <xc:this.script_expand>
            <![CDATA[expand("#{id:repeatfifthlevelnodes}");]]>
        </xc:this.script_expand>
    </xc:ccPanelNavigation>
</xp:repeat>