Expand my Community achievements bar.

SOLVED

Tag libraries related doubts

Avatar

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

Avatar

Correct answer by
Former Community Member

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

Avatar

Correct answer by
Former Community Member

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

Avatar

Employee

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

I would always use the CQ-tags.

Avatar

Level 9

Hi Feike/swesto01,

Thanks a lot for providing inputs on this.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----