I want a list of components in a page while using recursion method in java
parent 1, child 2 , grandchild 3 and there might be another child will also come there
As shown in picture there are some "container" nodes having components inside. For every container node it should get node of the component and add to a java map of values title and heading of the node
NOTE : It should maintain the page order of components
Any reference please?
解決済! 解決策の投稿を見る。
トピックはコミュニティのコンテンツの分類に役立ち、関連コンテンツを発見する可能性を広げます。
表示
返信
いいね!の合計
Hello @keshava219
Please refer to the example on Resource Streams in Apache Sling / Blogs / Perficient
It is exactly what you need "example of how one could extract a stream of resources by a page’s component type under a cq:Page"
A suggestion: Do not filter on nodename. Rather use sling:resourceType of container component. If there are sibling containers, except first one all others would have a suffix
This is good usecase to make use of ResourceStreams. Refer to my article here:
https://medium.com/@bsaravanaprakash/stop-running-aem-queries-on-aemcaas-instead-3add184e7e2a
Basically you start from page node, define branch selector and child selector based of your requirement and use foreach to implement the logic.
Hope this helps.
Hello @keshava219
Please refer to the example on Resource Streams in Apache Sling / Blogs / Perficient
It is exactly what you need "example of how one could extract a stream of resources by a page’s component type under a cq:Page"
A suggestion: Do not filter on nodename. Rather use sling:resourceType of container component. If there are sibling containers, except first one all others would have a suffix