包未定义
问题描述:
我用javascript编写了一个脚本,并在规则中使用了它(共享)。脚本开始于:
i wrote a script in javascript and used it in rules (share). The script start with:
var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
我遇到一个错误,告诉我参考错误:未定义软件包。
I m getting an error telling me that "Reference error: Packages is not defined".
我该如何解决这个问题?
How can i solve this issue?
答
Packages
对象仅适用于被认为安全的代码。这很可能失败,因为代码来自存储库/数据字典中的节点。将其放在类路径中的某个位置(例如 classes / alfresco / templates / webscripts /...
)。
The Packages
object is only available for code which is considered "secure". This is most likely failing because the code is from a node in the Repository/Data-Dictionary. Put it somewhere in the classpath (e.g. classes/alfresco/templates/webscripts/...
).