【发布时间】:2022-07-01 06:03:28
【问题描述】:
我正在使用 Groovy 控制台,需要通过页面标题中的值更新页面上的标题组件
getNode(\'/content/\').recurse { resourceNode ->
if (resourceNode.hasProperty(\'sling:resourceType\')) {
final def resourceType = resourceNode.getProperty(\'sling:resourceType\').string
if (resourceType.equals(\'components/title\')) {
resourceNode.setProperty(\'jcr:title\', resourceNode.parent().parent().getProperty(\'jcr:title\')) <-problem with this line
resourceNode.save();
}
}
}
我需要两个节点以上的值
我有一个例外:
groovy.lang.MissingMethodException:没有方法签名:org.apache.jackrabbit.oak.jcr.session.NodeImpl.parent() 适用于参数类型:() 值:[]
感谢帮助
标签: groovy aem groovy-console