我正在尝试从我的 jsp 中删除一些 scriptlet,并且几乎具有相同的代码,但是我的模型类以某种方式抛出了错误。主要区别在于 JcrUtils.getChildNodes() 命令本质上调用节点上的 Node.getNodes() 并返回一个 Iterable 实例。我已经为此绞尽脑汁了好几个小时,但无法弄清楚:
JSP:
final String HEADER = "header"
final Node headerNode = currentNode.hasNode(HEADER)
NodeIterator childLinks = headerNode.getNodes();
while ( childLinks.hasNext() ) {
Node link = (Node) childLinks.next();
headerNode = link.getProperty("headerTitle");
//do something with more child node properties
}
型号类:
final String HEADER = "header"
final Node headerNode = currentNode.hasNode(HEADER)
def headerNodeTitle = JcrUtils.getChildNodes(headerNode).find{ it.hasProperty("headerTitle") }
selectHeaderLabel = topicNode.getProperty("headerTitle").getString();
错误
No signature of method: static org.apache.jackrabbit.commons.JcrUtils.getChildNodes() is applicable for argument types: (java.lang.String) values: [true]