We want to display FAQs dynamically on the page based on the tags, so I wrote the Java code for that, but when I looked at the log statements, I saw that it doesn’t go inside while loop only, and also listChildren doesn’t return, so please look at the below Java code and log statements, and confirm me if I missed anything.
faqImpl.java
28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Starting FaqImpl initialization... 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl FAQ Path: /content/dam/amex/en-us/business/blueprint/faq-cf 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Selectors: [] 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl FAQ Tag: faq:faq-topic/business-line-of-credit/loans 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl FAQ Tag Object: /content/cq:tags/faq/faq-topic/business-line-of-credit/loans 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Retrieved Resource for Tag: /content/cq:tags/faq/faq-topic/business-line-of-credit/loans 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Retrieved Resource for Tag: /content/cq:tags/faq/faq-topic/business-line-of-credit/loans 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Size of Tagged Resources: 0 28.12.2023 23:58:07.776 *WARN* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Tagged Resources is null or empty for faqTag: faq:faq-topic/business-line-of-credit/loans 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl FaqImpl initialization completed successfully. 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl Is FAQ Page: false 28.12.2023 23:58:07.776 *INFO* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] com.amex.gcdt.models.FaqImpl FAQ Fragments: [] 28.12.2023 23:58:07.783 *ERROR* [10.16.228.4 [1703833087713] GET /content/amex/en-us/business/blueprint/faq-test.html HTTP/1.1] org.apache.sling.servlets.get.impl.DefaultGetServlet No renderer for extension html, cannot render resource JcrNodeResource, type=nt:unstructured, superType=null, path=/conf/onecms/settings/wcm/templates/editable-enterprise/structure/jcr:content/cq:responsive-disable
Views
Replies
Total Likes
Try passing the tag value instead of the tag path
//Try this
// Find resources directly associated with the tag
Resource tagResource = resourceResolver.getResource(faqTag);
Instead of this
// Find resources directly associated with the tag
Resource tagResource = resourceResolver.getResource(faqTagObject.getPath());
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies