如何在JAVA中删除CQ节点的属性
问题描述:
如何在JAVA代码中删除节点的属性?
我已经尝试过-
how can I remove the property of a node in JAVA code? I have tried something like -
node.setProperty(propertyName, null);
是否可以尝试一些特定的东西?
Is there something specific which I can try?
答
假定您的 setProperty方法有错别字,则可能会收到模棱两可的方法错误。如果这样,则应该进行类型转换:
Supposing that you have a typo with your "setProperty" method, you may be getting ambigous method error. You should do type casting if so:
node.setProperty(propertyName, (Value)null);
或使用删除方法
node.getProperty(propertyName).remove();
session.save();