从 ssjs 使用 Openlog。 'this' 应该是什么?

Using Openlog from ssjs. what should 'this' be?

我正在阅读关于 openlog 的文档:

Because Server-Side JavaScript Script Libraries have no context for which component called them, you will not be able to use this to pass the component to OpenLog. Instead, if you wish to identify which component called the code, you need to pass the component into your SSJS function as a parameter.

https://wiki.openntf.org/display/XOL/Using+from+SSJS+Script+Libraries

所以我有一个 link 调用驻留在脚本库中的 SSJS 函数:

<xp:link escape="true" text="#{obj.name}" rendered="#{obj.internal eq '3'}">
        <xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="dlgAssessment"> <xp:this.action><![CDATA[#{javascript:openDialogAssessment(this);}]]></xp:this.action> </xp:eventHandler> </xp:link>

函数注册失败到openlog如下:

function openDialogAssessment(component){
    try {       
        try{
           assessmentBean.removeAssessment("assessment");
        }catch(e){
            openLogBean.addError(e,component);
        }
//... more code
}

如果我查看 openlog 中的日志结果,我会读到:

null - Developer has passed 'this' directly from an SSJS function in Script Library /proposal.jss. Please note, SSJS Script Libraries have no context for components. You must pass the relevant component into your SSJS function as a parameter.

谁能告诉我我做错了什么以及如何将组件正确传递给函数?

正如 Ferry 所说,这是指组件,而不是功能。因此,应该将组件提供给 ssjs 函数,例如this.getParent().

在此上下文中 'this' 是 eventHandler。 eventHandler 不是 UIComponent。在这种情况下,您应该传递 'this.getParent()'(link)。