How to include an existing component multiple times | Community
Skip to main content
October 16, 2015
Solved

How to include an existing component multiple times

  • October 16, 2015
  • 2 replies
  • 1371 views

I am going to create a component which needs to reuse the existing component 3 times. In my component's JSP file I added following but getting blank page when creating a template for my component and then creating a page for that template.

<code><%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %><% %> haha <cq:include path="test" resourceType="/apps/help/components/relatedlinks" /> <cq:include path="test1" resourceType="/apps/help/components/relatedlinks" /> <cq:include path="test2" resourceType="/apps/help/components/relatedlinks" /> </code>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ogill

Hi,

Are you getting any errors in the error.log file? Does it work when you replace your custom components with OOTB components? 

I just tried the code below and it works as expected:

<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %><%
%><div class="center">
    <cq:include path="title1" resourceType="foundation/components/title" />
    <cq:include path="title2" resourceType="foundation/components/title" />
    <cq:include path="title3" resourceType="foundation/components/title" />
</div>

2 replies

Lokesh_Shivalingaiah
Level 10
October 16, 2015

This should work... are you facing any issues ?

ogillAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

Are you getting any errors in the error.log file? Does it work when you replace your custom components with OOTB components? 

I just tried the code below and it works as expected:

<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %><%
%><div class="center">
    <cq:include path="title1" resourceType="foundation/components/title" />
    <cq:include path="title2" resourceType="foundation/components/title" />
    <cq:include path="title3" resourceType="foundation/components/title" />
</div>