Hi All,
Can some one please let me what is the alternative for below cq and sling include tags in sightly?
<c:include script="content.jsp"/>
<sling:include path="/conent/my-msm/us/en-us/mypage/jcr:content/mycomponent" resourceType="myapp/components/content/mycomponent"/>
I am looking more for something which can get included in another file at compilation time and not run time (sling include does this in JSP). Any help will be appreciated.
thanks
Bipin
Solved! Go to Solution.
Hi
Please have a look at this community articles:-
Should you use <cq:include> or <sling:include>?
When developing AEM components, Adobe recommends that you use <cq:include>.
<cq:include> allows you to directly include script files by their name when using the script attribute. This takes component and resource type inheritance into account, and is often simpler than strict adherence to Sling's script resolution using selectors and extensions.
As opposed to the cq:include tag, you could alternatively use sling:include tag, which provides attributes to modify the selectors & suffix on the request:
<sling:include resourceType="myComponent" path="my/path" addSelectors="altView"/>
Link:- https://helpx.adobe.com/experience-manager/kb/CQIncludes.html
//
What is the difference between
1. <c:import url="layout-link.jsp" />
2. <sling:include path="layout-link.jsp" />
3. <cq:include script="layout-link.jsp" />
1. <c:import url="layout-link.jsp" />
I assume this is the import tag of the Standard Tag Library. This tag is documented at http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/import.html and does not know about Sling directly.
But — asuming — this tag is using a RequestDispatcher to dispatch the request, this tag will also pass Sling and the Sling resource resolver.
2. <sling:include path="layout-link.jsp" />
This is the include tag of the Sling JSP Tag library. This tag knows about Sling and also supportsRequestDispatcherOptions.
3. <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.
Advantage of each tag and Usage:
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.
In the future, it is conceivable that the Sling and/or Communique tag library will also provide an import tag similar to the JSTL import tag to be able to further process the imported result.
I hope this would help you.
~kautu
Views
Replies
Total Likes
Hi
Please have a look at this community articles:-
Should you use <cq:include> or <sling:include>?
When developing AEM components, Adobe recommends that you use <cq:include>.
<cq:include> allows you to directly include script files by their name when using the script attribute. This takes component and resource type inheritance into account, and is often simpler than strict adherence to Sling's script resolution using selectors and extensions.
As opposed to the cq:include tag, you could alternatively use sling:include tag, which provides attributes to modify the selectors & suffix on the request:
<sling:include resourceType="myComponent" path="my/path" addSelectors="altView"/>
Link:- https://helpx.adobe.com/experience-manager/kb/CQIncludes.html
//
What is the difference between
1. <c:import url="layout-link.jsp" />
2. <sling:include path="layout-link.jsp" />
3. <cq:include script="layout-link.jsp" />
1. <c:import url="layout-link.jsp" />
I assume this is the import tag of the Standard Tag Library. This tag is documented at http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/import.html and does not know about Sling directly.
But — asuming — this tag is using a RequestDispatcher to dispatch the request, this tag will also pass Sling and the Sling resource resolver.
2. <sling:include path="layout-link.jsp" />
This is the include tag of the Sling JSP Tag library. This tag knows about Sling and also supportsRequestDispatcherOptions.
3. <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.
Advantage of each tag and Usage:
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.
In the future, it is conceivable that the Sling and/or Communique tag library will also provide an import tag similar to the JSTL import tag to be able to further process the imported result.
I hope this would help you.
~kautu
Views
Replies
Total Likes
<c:include script="content.jsp"/>
HTL: data-sly-include="content.jsp"
<sling:include path="/conent/my-msm/us/en-us/mypage/jcr:content/mycomponent" resourceType="myapp/components/content/mycomponent"/>
HTL: data-sly-resource="${ @ path = '/content...' , resourceType='myapp/../..'}"
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies