How to remove a property of a CQ node in JAVA

僤鯓⒐⒋嵵緔 提交于 2019-12-12 18:28:44

问题


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?


回答1:


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);

or use remove method

node.getProperty(propertyName).remove();
session.save();



回答2:


you are missing

session.save();


来源:https://stackoverflow.com/questions/33995675/how-to-remove-a-property-of-a-cq-node-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!