Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Tag libraries related doubts

askdctm
Level 9
Level 9

Hi All,

In link https://docs.adobe.com/docs/en/cq/5-6/howto/taglib.html , there are couple of tag libraries which look similar

<CQ:INCLUDE>

<SLING:INCLUDE>

<SLING:DEFINEOBJECTS>

<CQ:DEFINEOBJECTS>

Is there any difference between these or they serve the same purpose. If there is any snippet of code that explains the difference, it would be helpful.

Can you please provide some inputs on this.

1 Accepted Solution
swesto01
Correct answer by
Level 2
Level 2

They can be used to achieve the same result, however it would really depend on what you are trying to do.  For example, the <sling:include> can do the same thing as the <cq:include>, but it has more parameters that you can use if you need them. You can read more about the attributes in the Sling documentation here: http://sling.apache.org/documentation/bundles/sling-scripting-jsp-taglib.html#include.

I would recommend reading these two articles if you would like more information on <sling:include> and <cq:include>:

http://dev.day.com/content/ddc/blog/2010/09/crx_gems_using_slin.html

https://helpx.adobe.com/experience-manager/kb/CQIncludes.html

View solution in original post

3 Replies
swesto01
Correct answer by
Level 2
Level 2

They can be used to achieve the same result, however it would really depend on what you are trying to do.  For example, the <sling:include> can do the same thing as the <cq:include>, but it has more parameters that you can use if you need them. You can read more about the attributes in the Sling documentation here: http://sling.apache.org/documentation/bundles/sling-scripting-jsp-taglib.html#include.

I would recommend reading these two articles if you would like more information on <sling:include> and <cq:include>:

http://dev.day.com/content/ddc/blog/2010/09/crx_gems_using_slin.html

https://helpx.adobe.com/experience-manager/kb/CQIncludes.html

Feike_Visser1
Employee
Employee

The CQ-tags add more CQ/AEM specific functionalities on top of the Sling-tags.

I would always use the CQ-tags.

askdctm
Level 9
Level 9

Hi Feike/swesto01,

Thanks a lot for providing inputs on this.