user3732294
user3732294

Reputation: 43

Difference between cq include ,sling include and jsp include

What is the difference between sling and cq includes and when should each one be used? I find both solving the same purpose.

How this both are different from jsp include

Upvotes: 2

Views: 2104

Answers (1)

Prashant Thorat
Prashant Thorat

Reputation: 1812

  1. <sling:include path="layout-link.jsp" />

This is the include tag of the Sling JSP Tag library. This tag knows about Sling and also supports RequestDispatcherOptions.

  1. <cq:include script="layout-link.jsp" />

This tag is Communiqué specific extension of the Sling JSP Tag library include tag. IIRC it supports callings scripts in addition to just including renderings of resources.

In a Communiqué application, I would suggest to generally use the Communiqué or Sling include tag since this provides you more Sling support.

You may use the JSTL import tag if you don't have specific requirements for Sling extended features, plan to use the JSP (fragment) outside of Communiqué or if you want to further process the generated (imported) content with a reader or a variable.

For more details, see The AEM KB entry on what is the difference between c:import, sling:include, and cq:include?

Upvotes: 1

Related Questions